0

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";
8
  • 2
    Possible duplicate of How can I get query string values in JavaScript? Commented Jul 25, 2016 at 7:27
  • What have you tried, anyway? Commented Jul 25, 2016 at 7:27
  • 2
    Url.split('?')[1] or Url.slice(Url.lastIndexOf('?') + 1) Commented Jul 25, 2016 at 7:28
  • 1
    var params = Url.split('?')[1]; Commented Jul 25, 2016 at 7:28
  • 1
    @PranavCBalan this is a lot simpler to use , thanks Commented Jul 25, 2016 at 7:51

2 Answers 2

2
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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.