0

I have write following code to split the URL

var href = document.URL;
var GlobalBoomGuid = href.split("=");
var optionid = GlobalBoomGuid[1];

If i have URL like this : www.mydomain.com?optionid=655 It's giving me "655" .

But in current scenario my URL is www.mydomain.com?optionid=655#&ui-state=dialog and it's returning me 655#&ui-state

Now i want only id . How should i do that ?

Please if you dont like the question don't mark as a Negative

Thanx in Advance :)

Rushikesh jogle
  • 591
  • 2
  • 9
  • 29
  • Refer [this](http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript) SO question. – Domain Nov 21 '14 at 13:56

1 Answers1

1

This gets your result

var href =  document.URL;
var foo = href.split("=")[1];
var GlobalBoomGuid = foo.split("#")[0];
var optionid = GlobalBoomGuid;

fiddle

Jegger
  • 26
  • 3