I am using this to get the current url using jquery var current_link = location).attr('href'); but when I try to display this link, just for debugging by
var current_link = $(location).attr('href');
alert(current_link);
I get an alert of undefined. If I use this script in JSFiddle, I am getting the correct link. Is it s a problem of the django development server or by my browser or something else. Seems to be very confusing.
Why don’t you just do
location.href?You don’t need jQuery to get the current url.
This has nothing to do with django 🙂