Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How can I get query string values in JavaScript?

function getQuerystring(key) {
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        if (pair[0] == key) {
            return pair[1];
        }
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #I #query #string #values
ADD COMMENT
Topic
Name
4+2 =