How do I prevent multiple form submission in .NET MVC without using Javascript?

后端 未结 13 2123
情深已故
情深已故 2020-11-28 02:36

I want to prevent users submitting forms multiple times in .NET MVC. I\'ve tried several methods using Javascript but have had difficulties getting it to work in all browser

13条回答
  •  离开以前
    2020-11-28 03:14

    I've tried several methods using Javascript but have had difficulties getting it to work in all browsers

    Have you tried using jquery?

    $('#myform').submit(function() {
        $(this).find(':submit').attr('disabled', 'disabled');
    });
    

    This should take care of the browser differences.

提交回复
热议问题