$(function() { $("#dashboard_filters").submit(function(e){ e.preventDefault(); let url = $(this).attr('action'); let data = $(this).serialize(); $.get(url, data, function(response){ console.log(response); $("#result-contents").html(response); $('button[type="submit"]').prop('disabled', false); }); }); $("#reset-project-filters").click(function(e){ e.preventDefault(); let url = $("#dashboard_filters").attr('action'); $.get(url, function(response){ $("#result-contents").html(response); }); }); $('#myModal').on('show.bs.modal', function (event) { let button = $(event.relatedTarget); // Button that triggered the modal let title = button.data('title'); let image = button.data('image'); let modal = $(this); modal.find('.modal-title').text(title); modal.find('.news-body').html('
'); modal.find('.modal-body img').attr("src", image).attr('alt', title); modal.find('.loader').removeClass('show').addClass('show'); }); $("a.news-link").click(function(e){ e.preventDefault(); let url = $(this).attr('href'); let target = $(this).data('target'); $.get(url, function(response){ $(target).find('.loader').removeClass('show'); $(target).find('.modal-content').html(response); }); }); $(document).on("click", "a.contact_link", function(e){ e.preventDefault(); $(e.target).attr('disabled', true); let url = $(this).attr('href'); $.get(url, function(response){ }).done(function() { $(e.target).attr('disabled', true); window.location = "?persist"; }).fail(function() { alert( "There's been an error" ); }); }); });