asp.net mvc - Prevent multiple form submission MVC Jquery -
i using actionlink , jquery submit form. submitting form every time when clicking link. want submit form first time(once). code -
@html.actionlink(model.link, "defaultrate", "defaultrate", null, new { @class = "btnclick", onclick = "return false;" }) <script type="text/javascript"> $(document).ready(function () { $('.btnclick').click(function () { $(this).closest('form')[0].submit(); }); }); </script>
thanks in advance
this must work:
@html.actionlink(model.link, "defaultrate", "defaultrate", null, new { @class = "btnclick"}) <script type="text/javascript"> $(document).ready(function () { var allow = true; $('.btnclick').click(function () { if (allow){ $(this).closest('form')[0].submit(); allow = false; } else return false; }); }); </script>
Comments
Post a Comment