I'm using Ajax.ActionLink like this
@Ajax.ActionLink("link text", "action", new AjaxOptions(){ OnBegin = "test()" })
I want to be able to cancel the ajax call of the link based on the result of my test() function in javascript, like so
function test(){
if(condition){
//execute the ajax request
return true;
}else
{
//cancel the ajax request
return false;
}
}
I've seen tutorials demonstrating that this is possible, but I somehow can't get it to work.Can someone help me with that? Thanks!
Change
OnBegin = "test()"
to
OnBegin = "return test()"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.