-1

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!

1 Answers1

3

Change

OnBegin = "test()"

to

OnBegin = "return test()"