I am moving my project from jQuery to axios. It is working fine in other places but I am getting error in one specific place. axios is giving CORS error but jquery working fine. Here is the code:
jQuery
$.ajax({
url: 'my-url-here',
type: 'post',
data: JSON.stringify({
"attachmentNames": [ "filename.pdf" ]
}),
success: function (data) {
console.info(data);
}
});
axios
axios({
url: 'my-url-here',
method: 'post',
data: {
"attachmentNames": [ "filename.pdf" ]
}
}).then(function(resp) {
console.log(resp);
});