var CSRFToken = "b62cbab4d444f23a143d53f647585a1891c5ddb0b42a3abc94b69294cbb94c25"; function setSpecificRequestHeader(jqtype) { if (typeof window[jqtype] == 'function') { window[jqtype](document).ajaxSend(function( event, request, settings ) { if (!(/^http:./.test(settings.url) || /^https:./.test(settings.url))) { // Only send the token to relative URLs i.e. locally. request.setRequestHeader("X-CSRFToken",CSRFToken); } }); } }