akutqq
Last Updated: February 25, 2016
·
1.579K
· antillas21
D366b88f8176c49c38dbad747b9382f4

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:

$.ajaxSetup({
    headers: { 'X-Requested-With' : 'XMLHttpRequest' }
});

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

Say Thanks
Respond