I have a Lambda function on AWS and it's written in Python 3.6 I also have my API deployed and the CORS enabled to all of my resources When I test the POST from AWS API gateway it works fine and the same Success I get when I try it from Postman but when I try it from The html hosted in my S3 bucket it does not work! I try to make the post request like so:
$.ajax({
type: 'POST',
url: 'https://xxxxxxx.execute-api.us-east-1.amazonaws.com/dev/myapp',
data: '{"fName":"jonas","lName": "Hoda", " Email":"[email protected]", "Age": 45, "Hight": 190, "Income": 120000}',
success: function(data) { alert('data: ' + data); },
contentType: "application/json",
dataType: 'json'
});
But I keep getting the same response: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://app.my-real-domain.com' is therefore not allowed access. The response had HTTP status code 400.
What else do I have to do? Do I need to edit something in my API or at my Python function? Pleases help me fix this Thanks in advance ...