To get the path, you can use:
var pathname = window.location.pathname;
http://stackoverflow.com/questions/406192/how-to-get-the-current-url-in-jquery