$.ajax({
url: "RestEndPoint",
headers: {
'X-CSRF-TOKEN' : $('meta[name="csrf-token"]').attr('content')
}
method: 'POST',
dataType: 'JSON',
data: dataObj,
success: function(data) {
console.log('Success')
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
There are hundreds of ajax post calls. Is there a way to intercept all the calls in one place and add the header there? Cannot use ajaxPrefilter as jquery 1.11.3 doesn't support it.