LoginSignup
7

More than 5 years have passed since last update.

javascriptでGETパラメータを取得

Last updated at Posted at 2012-04-06
retrieveGETqs

// JavaScript Document
var qsParm = new Array();
function retrieveGETqs() {
    var query = window.location.search.substring(1);
    var parms = query.split('&');

    for (var i=0; i<parms.length; i++) {
        var pos = parms[i].indexOf('=');
        if (pos > 0) {
            var key = parms[i].substring(0,pos);
            var val = parms[i].substring(pos+1);
            qsParm[key] = val;
        }
    }
}

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7