javascript read query string values
URL: http://google/microsoft/sharepoint.aspx?id=2&Name=jQuery
Now i am going to read id and Name using below code.
URL: http://google/microsoft/sharepoint.aspx?id=2&Name=jQuery
Now i am going to read id and Name using below code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="jquery-1.8.2.min.js"></script> | |
<script type="text/javascript"> | |
var id = getQuery('id'); | |
var name = getQuery('Name'); | |
function getQuery(key) { | |
var temp = location.search.match(new RegExp(key + "=(.*?)($|\&)", "i")); | |
if (temp) { | |
return temp[1]; | |
} | |
} | |
alert(id); | |
alert(name); | |
</script> |