We need to retrieve parameters passed from one page to another, that have been added to the end of the URL with the ?fieldname=sssssss&2ndfield=ttttt.
Announcement
Collapse
No announcement yet.
Retrieving Parameters passed within the URL
Collapse
X
-
With javascript, I assume?
http://www.ipwebdesign.net/useful_parseUrl.html
If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
Bored? Visit http://www.kaelisspace.com/
-
Comment
-
Code:function parseQueryString() { var url = document.location.href; var qryStr = url.substr(url.indexOf("?")+1); var params = new Array(); var splits = qryStr.split("&"); for ( i = 0; i < splits.length; i++ ) { var actual = splits[i].split("="); params[actual[0]] = actual[1]; } return params }
You never have to change anything you got up in the middle of the night to write. -- Saul Bellow
Comment
-
Originally posted by shyamCode:function parseQueryString() { var url = document.location.href; var qryStr = url.substr(url.indexOf("?")+1); var params = new Array(); var splits = qryStr.split("&"); for ( i = 0; i < splits.length; i++ ) { var actual = splits[i].split("="); params[actual[0]] = actual[1]; } return params }
Comment
Comment