this seems to be a very simple problem, but i just can't get it done.

how do i set a variable which is to display url response?
let's say my request is "http://domain.com/datavalue.htm".
the request returns some value ( let's say "30.0" ) when i use it with browser.

now, i want to get that value dynamically using script or asp object
and put that 30.0 on my webpage.
how do i do it?

11 Years
Discussion Span
Last Post by Troy

I don't see how the value "30.0" is contained in the URL. But I assume you'll be passing in key-value pairs on the QueryString?

The JavaScript object you'll use is the "location" object. It returns the URL. It has further properties, that return just portions of the URL. Combine the location object with the .Search method, and you can parse your URL however you would like.


Akoloff, if you want to use ASP as you mentioned, then look up ASP's Request Object. It comes in three forms that apply to your scenario:

1. Request.Querystring : to retrieve values from the HTTP GET.
2. Request.Form : to retrieve values from the HTTP POST.
3. Request : will retrieve values from either. Querystring first, if not found, look in Form.

So if your URL was "http://domain.com/datavalue.htm?s=30.0":

Dim s
s = Request.Querystring("s")
Response.Write "<h1>" & s & "</h1>"

tgreer gave you some methods to work with the url/querystring in javascript because you posted in the DHTML/Javascript forum. Please post in the appropriate forum next time. Thanks.


Aha! Thanks, Gulraiz, for interpreting what akoloff really wanted. That is sometimes referred to as "screen-scraping". If you are using ASP.Net, akoloff, then the article that Gulraiz posted a link to, should do what you want. If you are using "classic" ASP with VBScript, I developed an ASP class that is very simple to use and gives you some powerful features. I wrote an article on how to use the class.


No, Troy I have to thank you for giving out the right term for this. Somehow I didnt get the exact word for it till you pointed it out. So, Thankyou for that, and I enjoyed your article. Do post something regarding asp.net though. A control to screen-scrap any valid url would be nice. I'm working on it already but its hard to find time these days. Happy Coding everyone...


This is a bit off-topic, but Gulraiz, I don't do .Net--so it's up to you to write that class! I was a hard-core Microsoft web developer using ASP/VBScript/MSSQL until .NET took over. There is so much I love about .NET. I am a fan of the C# language, and the framework provides a lot of power and functionality that in classic ASP, you had to purchase components to get the same functionality. But when I tried to jump into ASP.NET, I was a bit overwhelmed. Microsoft COMPLETELY changed the game, and I felt like almost none of my ASP experience applied to ASP.NET. This frustrated me, and I had to wonder if I poured effort into becoming a ASP.NET guru, if Microsoft would not just change the game on me again. In fact, I'm sure they will.

At that same time, I had an Internet application with very heavy database needs, and our team could not afford to license MS SQL Server at $5,000 per processor for web licensing! So we looked at MySql, and in the process looked at Linux, Apache, and PHP as well. It took me about 2 weeks to fall in love with PHP. PHP is a far superior scripting language to the ASP/VBScript system. And on a power/feature level, I don't know what ASP.NET offers over PHP. The ability to compile your application is probably one thing ASP.NET claims as a big advantage.

In my opinion, .NET takes web development out of the hands of the casual scripter. Most professional programmers may consider this a good thing, but I'm not so sure.

Actually, I'm probably just mad and embarrassed that with my years of web development experience doing things the Microsoft way prior to .NET, ASP.NET did not make any sense to me! :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.