harness-drone/static/scripts/csrf.js

12 lines
308 B
JavaScript
Raw Normal View History

2015-09-30 01:21:17 +00:00
$(function () {
// fetch the CSRF token from the meta tag
var token = $("meta[name='_csrf']").attr("content");
// ensure every Ajax request has the CSRF token
// included in the request's header.
$(document).ajaxSend(function(e, xhr, options) {
xhr.setRequestHeader("X-CSRF-TOKEN", token);
});
});