[Answer]-Passing form variable dynamically to Django template tag

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

Leave a comment