Revision: 59394
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
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(); for(i=0;i<=urlParams.length-1;++i){ var param=urlParams[i].split('='); var name=param[0]; var value=param[1]; $_GET[name]=value; } 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
JavaScript