0

I have an unknown number of params in the URL. I want to write those in an Array, which i can use to refin a search.

But i don't know how. I found a big amount of scripts that work with just one Parameter. The idea is to work with for each, or something like this.

Example Url:

https://exampleurl.com&func=ll&nexturl=&promting=done&inputLabel1=(OTSubType:0 or OTSubType:144)&DSmaxrows=20&&folds=checked

Thanks for your help! Greetings, gefler

gefler
  • 1

1 Answers1

0

function getParams(url){
    var params = [];
    url.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) {
        params.push({ key: key, value: value });
    });
    return params;
}


var yourUrl = "https://exampleurl.com&func=ll&nexturl=&promting=done&inputLabel1=(OTSubType:0 or OTSubType:144)&DSmaxrows=20&&folds=checked";

console.log(getParams(yourUrl))
makeitmorehuman
  • 11,287
  • 3
  • 52
  • 76