Prevent double submission of forms in jQuery

后端 未结 22 1601
旧时难觅i
旧时难觅i 2020-11-22 08:10

I have a form that takes a little while for the server to process. I need to ensure that the user waits and does not attempt to resubmit the form by clicking the button agai

22条回答
  •  萌比男神i
    2020-11-22 08:24

    I solved a very similar issue using:

    $("#my_form").submit(function(){
        $('input[type=submit]').click(function(event){
            event.preventDefault();
        });
    });
    

提交回复
热议问题