Skip to content

Instantly share code, notes, and snippets.

View ttamg's full-sized avatar

Matt G ttamg

  • London
View GitHub Profile
@ttamg
ttamg / ajax_get.js
Created May 26, 2019 17:58
Opens a modal window and fetches the Django form (in HTML) by AJAX
// Parameters ...
// Trigger: A click on a button with 'openModal' class
// Requires: modal-id as attribute on the button
// URL: fetched from the ajax-url attribute on the modal Content div
$(document).ready(function () {
// A function to run on the click event to open modal, and fetch form via GET AJAX request
$('.openModal').on('click', function () {
var modalID = $(this).attr("modal-id");