Created
June 5, 2014 14:51
-
-
Save jeqo/964d98ccf8dc70e5eb35 to your computer and use it in GitHub Desktop.
JS code to print the request parameters.
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Start Page</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
</head> | |
<body> | |
<h1>Hello World!</h1> | |
<script> | |
// get the current URL | |
var url = window.location.toString(); | |
//get the parameters | |
url.match(/\?(.+)$/); | |
var params = RegExp.$1; | |
// split up the query string and store in an | |
// associative array | |
var params = params.split("&"); | |
var queryStringList = {}; | |
for (var i = 0; i < params.length; i++) | |
{ | |
var tmp = params[i].split("="); | |
queryStringList[tmp[0]] = unescape(tmp[1]); | |
} | |
// print all querystring in key value pairs | |
for (var i in queryStringList) | |
document.write(i + " = " + queryStringList[i] + "<br/>"); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment