Sunday, July 1, 2018

javascript - Why my $.ajax showing "preflight is invalid redirect error"?

I tried the following code in Postman and it was working. Is there something wrong with the code?



$.ajax({
url: 'http://api.example.com/users/get',
type: 'POST',
headers: {
'name-api-key':'ewf45r4435trge',
},
data: {

'uid':36,
},
success: function(data) {
console.log(data);
}
});


I got this error in my console as below, please advise.





XMLHttpRequest cannot load http://api.example.com/users/get Response
for preflight is invalid (redirect)


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...