Skip to content

Instantly share code, notes, and snippets.

@ttamg
Created May 26, 2019 18:09
Show Gist options
  • Save ttamg/c2eb5774f6abbbf098ba0186215c1d7b to your computer and use it in GitHub Desktop.
Save ttamg/c2eb5774f6abbbf098ba0186215c1d7b to your computer and use it in GitHub Desktop.
Django form template to fill out the modal window and load the ajax_post.js script to manage the submission of the form
<div class="submitByAJAX">
<form method="POST" action="{% url 'message_new' %}">
{% csrf_token %}
{{ form }}
<button type="submit" value="submit" class="btn">Submit</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</form>
</div>
<script>
{% include 'ajax/ajax_post.js' %}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment