1👍
✅
{% url myView dynamicVar %}
is rendered on the server side, so you have to:
var dynamicVar = $('#country').val();
var url = 'http://your_site.com/autocomplete_country/' + dynamicVar + '/'
To avoid hardcoding server name in the template, use request.get_host
Source:stackexchange.com