Jump to content

Get Url Variable From "url=" Parameter..?


cyfer65
 Share

Recommended Posts

Guest FirefoxRocks

If the url parameter is the only parameter in the URL, you can just use substr() to get the last characters of the string. Otherwise you will need to use more complex regular expressions to find where the url parameter begins and ends.

Link to comment
Share on other sites

You don't need regular expressions to get values from the query string. Here's a simple method:

// Remove '?' from the query stringvar i, q;var query = location.search.substr(1)// separare variablesquery = query.split("&");var $_GET = new Object();for (i = 0; i < query.length; i++) {  q = query[i].split("=");  $_GET[q[0]] = q[1];}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...