I am making a POST request to AWS s3 API gateway using JQUERY & AJAX. Upon submit, the shadow is updated. However I get an error in the console. Here is the ajax part of the code,
var myJSON = JSON.stringify(obj);
$.ajax({
type: "POST",
url: "<aws-url>" ,
data: myJSON,
crossDomain : true,
//dataType: 'jsonp',
headers :{
'Content-Type':'application/x-www-form-urlencoded'
},
success: function(result) {
console.log("done");
}
});
The POST works and the shadow is updated, but I still get this error at the console. Also I am aware that postman can't be used with POST method. Here is the error: Failed to load :No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://s3-ap-southeast-1.amazonaws.com' is therefore not allowed access.
I don't understand whats going on. Please help!!