var CSRFToken = "8c90c999f3342113e7860f04819c9b09f955f6b1632c226da6d87a7ae7ee5239"; 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); } }); } }