back to notes

AngularJS Ajax/Django calls not recognised as AJAX

Andrew Ellerton

Tech Lead and Software Engineer

For anyone who notes that AngularJS AJAX calls to a Django back-end don't get recognised as AJAX by Django, add this in your ng code:

// See http://django-angular.readthedocs.org/en/latest/integration.html
yourApp.config(function($httpProvider) {
$httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
});


last updated june 2014