Ajax提交form时Unobtrusive validation失败

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

$(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




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

猜你喜欢

转载自www.cnblogs.com/nirvanan/p/11963308.html