$(() => { $(document).on("click", "a[data-open-url],button[data-open-url]", (event) => { event.preventDefault(); const link = event.currentTarget; const $modal = $(`#${link.dataset.open}`); $modal.html("
"); $.ajax({ type: "get", url: link.dataset.openUrl, success: (html) => { const $html = $(html); $modal.html($html); $html.foundation(); }, error: function (request, status, error) { $modal.html(`${error}
`); } }); }); });