I have a url that looks something like this:
http://sitename.com?url=domin.com
and I need to take the part of the url after the Equal sign How do I display the value after the equal sign
in php, you do:
<?=$_GET['url']?>
In java you do :
var split = location.search.replace('?', '').split('=')
split[0] is your var name, and split[1] is your var value. You actually don't really need jQuery for that piece of code ;)
Splitting multiple variables can be done like that:
var split = location.search.replace('?', '').split('&').map(function(val){
return val.split('=');
});
You can access variable name by split[index][0] and value by split[index][1].
Of course you can use the second snippet instead of the first one for one variable too.
Or, for jQuery, you could use this plugin : https://github.com/mattsnider/jquery-plugin-query-parser
var split = location.search.replace('?', '').split('=') window.location; then, on the second line you do: alert(split); OR you do console.log(split);, in which case, in google chrome you right click somewhere on the page, select "inspect element", then you click console and refresh..you should have the values there!