I have got a url by using
var url = window.location.href;
console.log(url);
This is the url
http://www.myproject.com/wp/?edit_project=797#step2=project
Now i want get the step2 from this url. Any clue how to get this only from the url.
I have got a url by using
var url = window.location.href;
console.log(url);
This is the url
http://www.myproject.com/wp/?edit_project=797#step2=project
Now i want get the step2 from this url. Any clue how to get this only from the url.
window.location.hash returns "#step2=project". And you need to parse it out(there is no restriction for the hash part of url).
This will work:
var startIndex = url.indexOf("step2");
var step2 = url.substr(startIndex);