impress/app/assets/javascripts/ajax_auth.js

11 lines
241 B
JavaScript
Raw Normal View History

2012-01-26 11:30:53 -08:00
(function () {
var CSRFProtection = function (xhr) {
var token = $('meta[name="csrf-token"]').attr('content');
if(token) xhr.setRequestHeader('X-CSRF-Token', token);
};
2012-01-26 11:30:53 -08:00
$.ajaxSetup({
beforeSend: CSRFProtection
});
2012-01-26 11:30:53 -08:00
})();