我正在像这样使用 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;
}
}
我看过教程证明这是可能的,但我无法让它工作。有人可以帮我吗?谢谢!