Final: AJAX/jQuery/PHP Form submission and modal box open on success

后端 未结 1 475
暗喜
暗喜 2021-01-26 03:47

Thanks to Samuel Liew and other great helpers, the issue has been fixed.

As putting everything here was a mess, and it was poorly explained in the overall solution, I de

相关标签:
1条回答
  • 2021-01-26 04:27

    In this case, move the dialog function outside of the submit function:

    $(function() {
        $('#popup-wrapper').modalPopLite({
            openButton: '#clicker',
            closeButton: '#close-btn'
        });
        $('#contact-form').submit(function() {
            $.ajax({
                type: "POST",
                url: $(this).attr('action'),
                data: $(this).serialize(),
                success: function() {
                    $('#contact-form')[0].reset();
                }
            });
            return false;
        });
    });
    
    0 讨论(0)
提交回复
热议问题