Last Updated: February 25, 2016
· antillas21

Backbone and CORS

When building a Backbone-based JS app, if you need to connect to a third-party API with CORS support, don't forget to adjust jQuery's ajaxSetup to use XMLHttpRequest:

    headers: { 'X-Requested-With' : 'XMLHttpRequest' }

This will save you some headaches when making requests to the API.