Skip to content

Instantly share code, notes, and snippets.

@Microsofttechies
Created July 28, 2014 05:29
Show Gist options
  • Save Microsofttechies/cfdeec7f11874987d478 to your computer and use it in GitHub Desktop.
Save Microsofttechies/cfdeec7f11874987d478 to your computer and use it in GitHub Desktop.
javascript read query string values
<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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment