Read and Write GET / Query-string variables
Read, Add, Modify GET / Query String variables with these 2 functions
JavaScript
function getParameter(url,param){
alert(url);
url = url.split('?');
var pattern = new RegExp(param+'=(.*?)(;|&|$)','gi');
alert(pattern);
return url[1].split(pattern)[1];
}
var url = decodeURI(window.location.href);
alert(url);
var query ='?a=1&b=2&postcode=rg20bs'
var postcodeVal = getParameter(query,'postcode');
alert(postcodeVal);