Simulating Errors  page     

The following simulates an unauthorized request to /foo.

$.fixture("/foo", function(){
    return [401,"{type: 'unauthorized'}"]
   });

This could be received by the following Ajax request:

$.ajax({
  url: '/foo',
  error : function(jqXhr, status, statusText){
    // status === 'error'
    // statusText === "{type: 'unauthorized'}"
  }
})
© Jupiter IT - JavaScriptMVC Training and Support