how to get last segment of url in javascript