[英]How to cancel ajax request using Jquery.Unobtrusive.Ajax?
我正在像这样使用Ajax.ActionLink
@Ajax.ActionLink("link text", "action", new AjaxOptions(){ OnBegin = "test()" })
我希望能够根据我在javascript中的test()函数的结果来取消链接的ajax调用,就像这样
function test(){
if(condition){
//execute the ajax request
return true;
}else
{
//cancel the ajax request
return false;
}
}
我看过一些教程证明这是有可能的,但是我莫名其妙地使它无法工作,有人可以帮我吗? 谢谢!
更改
OnBegin = "test()"
至
OnBegin = "return test()"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.