[removed] Detect form submission completion

2019-02-26 00:08发布

问题:

I have a form in an iframe and submit it. How can I tell when the submission completes? I'm using jQuery to submit the form but don't think there's a callback:

$("#myForm").submit(); // how to attach event to submission complete?

回答1:

Submission of the form will redirect you to the next page.

But you can always try the ajax function

http://api.jquery.com/jQuery.ajax/

Adding callback is as easy as

 $.ajax({
   url: "page.php",
   success: function() {
      doWhateverYouWant();
   }
 });


回答2:

If you submit a form, it goes to the next page, so there's nothing else that executes on that page.