Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How to retrieve GET parameters from JavaScript

function getSearchParameters() {     var prmstr = window.location.search.substr(1);     return prmstr != null && prmstr != "" ? transformToAssocArray(prmstr) : {}; }  function transformToAssocArray( prmstr ) {     var params = {};     var prmarr = prmstr.split("&");     for ( var i = 0; i < prmarr.length; i++) {         var tmparr = prmarr[i].split("=");         params[tmparr[0]] = tmparr[1];     }     return params; }  var params = getSearchParameters();
Source by www.thecodeteacher.com #
 
PREVIOUS NEXT
Tagged: #How #retrieve #GET #parameters #JavaScript
ADD COMMENT
Topic
Name
1+3 =