Avoiding Duplicate form submission in Asp.net MVC by clicking submit twice

前端 未结 6 1688
情书的邮戳
情书的邮戳 2021-01-30 22:30

I am rendering a form in Asp.net MVC with a submit button. The page redirects after successful record addition into the database. Following is the code :-

[HttpP         


        
6条回答
  •  悲&欢浪女
    2021-01-30 22:48

    The solution for mvc applications with mvc client side validation should be:

    $('form').submit(function () {
        if ($(this).valid()) {
            $(':submit', this).attr('disabled', 'disabled');
        }
    });
    

提交回复
热议问题