Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test JQuery fail callback?

This is jquery function:

$.get("/url", function(){

   //success
}).fail(function(){
  //fail     <---- how to make code go in there.
});

Problem is how to let program goes into .fail block, I use .Net MVC, However, set break point in Controller doesn't trigger a timeout exception then leads to fail callback.

Don't know how people test this.

Should I start looking at some tools ?

like image 796
CodeFarmer Avatar asked Apr 24 '15 08:04

CodeFarmer


1 Answers

Put this in your Controller method:

return new HttpStatusCodeResult(HttpStatusCode.NotFound);
like image 186
Serj Sagan Avatar answered Nov 01 '22 08:11

Serj Sagan