Forum Moderators: open

Message Too Old, No Replies

JavaScript and Request.Querystring

         

aax123

6:01 pm on Jan 24, 2006 (gmt 0)

10+ Year Member



Why am I receiving this error. Can't Request.Querystring be used in Javascript?

Error: 'request' is Undefined.
-----------------------
[localhost...]

var QueryVariable = new String(request.querystring("c"));
if ((require_class == "Y") && (QueryVariable!= 0)) {

}

dr_benway

10:15 pm on Jan 24, 2006 (gmt 0)



Actually, Request.Querystring is a Visual Basic construct only available in ASP.

What you want is location.search . You can't refer to each of the items that may be in the querystring by name
(as in vb: Request.Querystring("ThingsName") returns the value of "ThingsValue" from foo.com/mypage.htm?ThingsName=ThingsValue.

You'll need to do some string handling to get the values you want; look up split() and substring() to get started.