Return to Snippet

Revision: 59394
at September 6, 2012 04:42 by sergiazow

Initial Code
var $_GET=new function(){
	var fullUrl=window.location.href.split('?');
	var urlParams=fullUrl[1].split('&');
	$_GET=new Array();
		var param=urlParams[i].split('=');
		var name=param[0];
		var value=param[1];
	return $_GET;

Initial URL

Initial Description
Simulate the $_GET array from php in javascript to get url parameters this way:
url= http://localhost/?var1=example
$_GET['var1'] will return "example"

Just copy and paste the code.

Initial Title
Function to simulate PHP $_GET in javascript

Initial Tags
javascript, php, function

Initial Language