문제

The query strings in my ASP.NET MVC are formatted like this: http://mysite.com/blog/tag/my-tag, instead of http://mysite.com/blog/?tag=my-tag, I need to extract the "my-tag" bit out of the URL, how could I accomplish that with jQuery on document loaded?

도움이 되었습니까?

해결책

No need to use jQuery for that:

var tag = window.location.href.split('/').pop();

다른 팁

Try This:

document.location.toString().match('.*/(.*)$')[1]
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top