I’m trying to run an ajax
call to an external URL using “CORS Anywhere”.It worked fine but now resulting this error : Missing required request header. Must specify one of: origin,x-requested-with
I just can’t understand why this would happen
var CORS = 'https://cors-anywhere.herokuapp.com/';
$.ajax({
url: CORS + 'https://egtapp.com/bc/hotel/123456/inf/json/api/',
dataType: "json",
type: "GET",
success: function (jsonObject, status) {
console.log(jsonObject)
},
});
3
Answers
Attach header
x-requested-with
:Please check url first. you r adding *CORS + ‘https://egtapp.com/bc/hotel/123456/inf/json/api/‘ * which means you want get something
from following link:
https://cors-anywhere.herokuapp.com/https://egtapp.com/bc/hotel/123456/inf/json/api/
I don’t think this a valid url..
After ensuring url, you can write:
Mona, I think that is not from cors anywhere, that message comes from your target URL.
So you should attach that header.