To call a Django view from HTML we use the following:
"{% url 'namespace: view_fun' %}"
But how to do this from Javascript?
Thank you!
To call a Django view from HTML we use the following:
"{% url 'namespace: view_fun' %}"
But how to do this from Javascript?
Thank you!
One hacky way to do it would be to include following script in your template that references the javascript file.
<script>
var fun_url = "{% url 'namespace: view_fun' %}";
</script>
And then expecting this fun_url
variable in your referenced javascript file.