0

Anyone can help me work out in using the AMP Contact form? I am doing a subscribe form using Mailchimp and SendEngine and I embedded the form to my HTML page.

Here is the screenshot of the error:

Error when submitting form

Allen Fernandes
  • 1,293
  • 11
  • 18
  • Google for CORS, you'll find plenty of questions on Stack Overflow that will help you – Patrick Hund Nov 07 '17 at 21:43
  • Thanks. Do you have a working form so that I can compare it. I dont know where I got wrong – Benjamin Jaljis Nov 08 '17 at 07:02
  • You are doing an XMLHttpRequest to a different domain than your page is on. So the browser is blocking it as it usually allows a request in the same origin for security reasons. You need to do something different when you want to do a cross-domain request. A tutorial about how to achieve that is [Using CORS](http://www.html5rocks.com/en/tutorials/cors/http://www.html5rocks.com/en/tutorials/cors/). Please read the related question, I'm voting to close this as a duplicate: https://stackoverflow.com/questions/20035101/why-does-my-javascript-get-a-no-access-control-allow-origin-header-is-present – Patrick Hund Nov 08 '17 at 07:47
  • Possible duplicate of [Why does my JavaScript get a "No 'Access-Control-Allow-Origin' header is present on the requested resource" error when Postman does not?](https://stackoverflow.com/questions/20035101/why-does-my-javascript-get-a-no-access-control-allow-origin-header-is-present) – Patrick Hund Nov 08 '17 at 07:47

1 Answers1

2

This happens when you try to submit to a domain different than your AMP site.

You need to whitelist your AMP domain on your server to enable CORS or contact Administrator if it's a shared hosting for your AMP domain to be whitelisted for CORS. Read further about CORS on AMP.

Also check out specs on CORS Whitelisting.

adnanyousafch
  • 1,172
  • 9
  • 26