开发者

How do I make form submission wait for an AJAX callback in jQuery?

I want to include an AJAX call within a .submit() handler so that I can proc开发者_StackOverflow中文版ess form data and send email confirmations before the form is fully submitted. Therefore I'd like to make the submission wait until the AJAX call is complete, so that I can cancel the submission or do other things based on the response.

How would I go about doing this?


There is no waiting in JavaScript.

The closest you can come is to stop the default action in the submit event of the form, and then call the submit method of the form element in the callback from the Ajax request.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜