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.
Written by Antonio Antillon
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Backbone.js
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#