I would like to add a custom header into my bloodhound request, here is my code but it doesn't work.
var datasource = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.whitespace,
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: url,
prepare: function (query, settings) {
var authHeaders;
settings.type = "POST";
settings.data = param + '=' + query;
settings.headers = {
'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
};
return settings;
},
wildcard: '%QUERY'
}
});
Any idea?