javascript q
javascript q
- Started
- Last post
- 2 Responses
- heavyt
am i trying to extract a variable from the URL of a page. I am lookign for indexOf(var) , then gettign the indexOf(&) after that. Those are my start and end for a substring that i make from teh URL.
it works well if there is a "&" after the var, but if it doesnt exist, the script fails.
in PHP i would use isset or !empty to check for this, is there sucha feature in JS?
TR1
- fugged0
try this:
http://www.alien109.com/request.…
it will parse the querystring and create an associative array that contains the name/value pairs from the querystring.
To access a variable you would use this format:
FORM_DATA["var_name"]
- heavyt0
thanks,
i ended up just passing a param in with PHP, but i think that script will come on handy in the future.
TR1