Backbone.js: define timeout for Backbone.sync implementation
Just pass a timeout:milliseconds
option in the options
argument to fetch
. The options get passed directly to jQuery.ajax, which handles the low-level XHR call:
collection.fetch({timeout:50000});
Alternatively you can set a global timeout for all the requests made by your application by calling jQuery.ajaxSetup in your application startup:
$.ajaxSetup({timeout:50000});