See this concerning headers and clearing all cache: https://stackoverflow.com/questions/60168052/laravel-cors-with-fruitcake
CORS issue on Edge browser
Hi - I have the javascript Ajax action (noted below) which removes a video record from a database row. The code works exactly as expected on Chrome, Firefox but fails on Edge, Safari and Opera. I'm hitting a CORS error (Failed to load resource: Origin **** is not allowed by Access-Control-Allow-Origin.). The page displays videos from an external server, which the user can then approve or reject. The page and videos all display exactly as expected on all browsers. I'm on Laravel 7 with fruitcake/laravel-cors loaded.
function toggle_Video_Approval(obj)
{
if(obj.id){
var data = {
'_token': $("input[name='_token']").val(),
'videotype_id': obj.id, //approved_###
'server_id': $(obj).attr('server_id')
};
var url = PATH+'AjaxVideoApproval';
runAjax(url, data, false);
}
}
which connects to:
function runAjax(url, data, callback)
{
$.ajaxSetup({
headers:{'X-CSRF-TOKEN': $("input[name='_token']").val()}
});
$.ajax({
type:'POST',
url: url,
data: data,
success:function(response){
AJAXRESPONSE = response;
//allow for no-callback option
if(callback){
callback();
}
},
error: function(jqXHR, textStatus, errorThrown){
console.log(JSON.stringify(jqXHR));
return false;
}
});
}
Any guidance on solving this is appreciated! Thanks - Rick
Please or to participate in this conversation.