jquery validate need to click submit twice to submit form

后端 未结 3 1537
南笙
南笙 2021-01-13 09:04

I have a form in a modal, the user has to complete the form (otherwise validation will display the required fields error messages), then click the submit input type, it does

3条回答
  •  隐瞒了意图╮
    2021-01-13 09:34

    You are binding a new submit event handler, within submitHandler callback of the plugin. This handler won't fire right away because a submit event is already in progress.

    You don't need it. The submitHandler callback will already preventDefault internally within plugin code

    Remove this

    $("#review-form").submit(function(event) { })

    and keep all the code it contains directly within submitHandler

    Since you are using serialize() for the data.... you don't need all the individual field variables you create either

提交回复
热议问题