Backbone.Paginator not working with custom api that returns JSON

I recently tried getting Backbone.Paginator¬†working with a custom API of mine and was puzzled when I couldn’t get a response after substituting my API url into one of the examples. ¬†The problem is that Backbone.Paginator is designed to be used with JSONP, which makes sense since it”ll likely be used for cross-domain api services.

You can quickly fix this by specifying the dataType in your collection’s fetch call, or by altering Backbone.Paginator. i.e.

myCollection.fetch({success: function(){console.log(“success!”);myCollection.pager();}, error: function(){console.log(“ERROR!”);}, dataType: ‘json’});



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Complete the CAPTCHA:
Complete the CAPTCHA to submit your comment.