jquery validate & ajax.beginform

前端 未结 1 467
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-21 16:53

Submitting an Ajax.Beginform while using the JQuery Validate plugin doesn\'t stop the submission. Is there a good way to ensure the Ajax.Beginform is not submitted?

I\'

1条回答
  •  不思量自难忘°
    2021-01-21 17:18

    It doesn't seem too hacky to me, but them I'm not the most elegant guy in the world. The only thing I think I'd do differently is set it up like this:

    $('#login').validate(); // setup form to use validation plugin 
    
    var options = {
        beforeSubmit: function() {
            return $('#login').valid(); // check form is valid
        },
        success: manageResponse
    };
    

    0 讨论(0)
提交回复
热议问题