Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : [SOLVED] How to use findAll() error param? Or how to show login form when login session is expired and user action calls can.Model.findAll()?

$
0
0
You can just use the fail callback and examine the status code returned by the request. E.g.

  1. app.SecureModel
  2.   .findAll()
  3.   .done( function( list ) { /* do whatever with your list of models when request has succeeded */ })
  4.   .fail( function( xhr ) {
  5.     if ( xhr.status === 401 ) { /* pop a window that will allow the user to login again before retrying the request */ }
  6.     else { /* pop a general error window, if you care about that kind of error reporting to the user */ }
  7.   })

Viewing all articles
Browse latest Browse all 3491

Trending Articles