当前位置:首页 > Web开发 > 正文

Ajax提交form时Unobtrusive validation失败

2024-03-31 Web开发

在页面加载完成时执行以下代码:

$(document).ajaxStop(function() { $.validator.unobtrusive.parse(‘form‘); });

https://forums.asp.net/t/1651961.aspx?Unobtrusive+validation+not+working+on+form+loaded+by+Ajax
===============

另一個差不多的是:
$(document).ajaxSuccess(function (event, xhr, settings) { if (settings.mvcTargetElement) { $(settings.mvcTargetElement.getAttribute("data-ajax-update")).each(function () { $.validator.unobtrusive.parse(this); }); } }); https://btburnett.com/2011/01/mvc-3-unobtrusive-ajax-improvements.html




我试验从未成功,但这是一个思路和方向。

Ajax提交form时Unobtrusive validation失败

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/42191.html