javascript - Prevent click before AJAX response -
javascript - Prevent click before AJAX response -
i'm submitting file ajax.
until reply request, show modal window, if users click on modal before answer, ajax request gets canceled. i'm looking way prevent that.
i'm using https://github.com/malsup/form/ post ajax
full code here : http://jsfiddle.net/wc9xn/4/
thanks
$('form').on('submit', function (e) { // show loading modal popup $("#dialog-modal").dialog({ height: 140, modal: true }); $(".ui-dialog-titlebar").hide(); e.preventdefault(); // prevent native submit $(this).ajaxsubmit({ url: '/unitary/import_ajax', type: 'post', datatype: 'json', iframe: true, success: function (data) { $('#dialog-modal').hide(); if (data == 'error') { alert('error, invalid file'); } else { var event = jquery.event; submitform(event, data); } } }) }); function submitform(event, data) { //do stuff }
$('form').off('submit').on('submit', function (e) { // show loading modal popup $("#dialog-modal").dialog({ height: 140, modal: true });
havent tried, see if works, add together off('submit')
.
javascript jquery ajax
Comments
Post a Comment