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";
asked Jul 25, 2016 at 7:26
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.

cdaiga
4,9374 gold badges25 silver badges44 bronze badges
answered Jul 25, 2016 at 7:30

Comments

0

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

var params = window.location.href.split('?')[1];
answered Jul 25, 2016 at 7:52

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.