To get the current path using javascript, you can use any of the following:
var pathname = window.location.pathname; // Returns path only
var url = window.location.href; // Returns full URL
var url = $(location).attr('href');
var pathname = window.location.pathname; // Returns path only
var url = window.location.href; // Returns full URL
var url = $(location).attr('href');