[Django]-How to call a django view function based on its namespace and fun name from js?

4👍

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.

Leave a comment