Arun Prasad E S
Arun Prasad E S

Reputation: 10115

Get the url Parameter string from Javascript

I need the whole parameter list as such , not one by one

var Url = "http://localhost/Home/Admin?param1=1&param2=2$param3=3";

I want to get the whole parameter list from the url.

var params = "param1=1&param2=2&param3=3";

Upvotes: 0

Views: 79

Answers (2)

Ray
Ray

Reputation: 280

var Url = "http://localhost/Home/Admin?param1=1&param2=2$param3=3";
var urlArray = url.split("?");
var params=urlArray[1];

You can see Using split() example of Mozilla Developer Network for more insight on using the split function.

Upvotes: 2

Arun Prasad E S
Arun Prasad E S

Reputation: 10115

Thanks for the support, I use this one for my need

var params = window.location.href.split('?')[1];

Upvotes: 0

Related Questions