Sunday 1 July 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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...