Page-Details : _GET Web Address Reader
General
This script will allow you to grab variable-value pairs from the URL of a page, much like PHP grabs data from the URL. It places foo=bar data in a JavaScript object called _GET, and can be referenced similar to $_GET in PHP.
Try it out:
- Enter any variable-value pair in the URL (adding it to the end of the URL),
e.g., "?my_name=Bob&last_name=Smith" (w/o quotes) - or click one of the sample links below:
_GET items found for this URL:
Notes
- Created by: Greg Burghardt
- Web Site: http://www.geocities.com/greg_burghardt/
- Posted: March 02, 2007
Source Code
Paste this source code into the designated areas.
External file
Paste this code into an external JavaScript file named: getReader.js
Head
Paste this code into the HEAD section of your HTML document.


Leave a Response
(4 comments)You will need to submit your question to the [a href="http://www.webdeveloper.com/forum/forumdisplay.php?f=3"]JavaScript Forum[/a] for further help.
I'm new to javascripting - How do you output this info on the page?
This script reads the URL of a web page, and then creates a JavaScript object of all the foo=bar pairs in the URL. For example, if you have somepage.php?section=news&id=25451, the _GET variable in JavaScript would have the following two properties:[p]_GET.section // Is set to "news"[br /]_GET.id // Is set to "25451"[p]One thing to note, even if you have a number value in the URL, like "25451", JavaScript will treat it like a string, so you'll need to use the parseInt or parseFloat functions to make them true numbers.[p]_GET.id // Is a string[br /]parseFloat(_GET.id) // Is an floating point number[br /]parseInt(_GET.id) // Is an integer number
I do not understand what this feature does. Thank You