For example I have the URL:
http://www.website.com/example?something=abc&a=b
How can I get the something's content, "abc" and the content of a as strings?
Thanks in advance, Mateiaru
For example I have the URL:
http://www.website.com/example?something=abc&a=b
How can I get the something's content, "abc" and the content of a as strings?
Thanks in advance, Mateiaru
//var url = window.location.href;
var url = "http://www.website.com/example?something=abc&a=b";
var attributes = url.split("?")[1].split("&");
var keyValue = {};
for(i in attributes)
{
var pair = attributes[i].split("=");
keyValue[pair[0]] = pair[1];
}
alert(keyValue["something"]);
alert(keyValue["a"]);