How do I get the last segment of a url? I have the following script which displays the full url of the anchor tag clicked:
$(\".tag_name_goes_here\").live(\
I believe it's safer to remove the tail slash('/') before doing substring. Because I got an empty string in my scenario.
window.alert((window.location.pathname).replace(/\/$/, "").substr((window.location.pathname.replace(/\/$/, "")).lastIndexOf('/') + 1));