why we set headers in ajax.whats the purpose of header in ajax.I dont know whats the header do.A little bit confusion arise when i analyse code.Just tell whats the header do or why we use.
$.ajax({
type: "GET",
cache: false,
url: $(this).data("url")+'?param='+status,
dataType: "json",
headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
success: function(res) {
if (res.flag == true) {
toastr["success"](res.msg, "Completed!");
if(res.action == 'reload') {
window.location.reload();
}else{
$("." + remvove).remove();
}
}
}
});
</div>