javascript - Get a substring from url jquery -
i working one-page website uses jquery , ajax. because 1 page website, url mydomain.com/#contact
. have made ajax call , want refresh page , scroll particular section of page different id say, mydomain.com/#home
. in order this, have current url using document.url
(let's returns mydomain.com/#contact
), remove /#contact
, replace /#home
. know can replace /#contact
/#home
concatenating +
don't know jquery function (if any) remove /#contact
.
thanks help
simply set hash, don't need evaluate existing url:
window.location.hash = "home";
Comments
Post a Comment