I really don't get why alert
or console.log
is not being triggered in this code:
$.post("http://localhost:8080/mail",
jsonObject,
function(data) {
console.log("Done!");
alert("Thank you for your inquiry. We will get back to you soon.");
alert("Response: " + JSON.stringify(data));
}
);
While I can see the mail API works as I was able to get the email with the values I put in the HTML forms. alert
and console.log
is not being triggered what could be the reason?
I can see this on the browser log though:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at
http://localhost:8080/mail
. This can be fixed by moving the resource to the same domain or enabling CORS.
Could this be the reason? If so what should I do to make $.post
trigger success or failure.