AMP amp-user-notification data-dismiss-href request making two requests

261 Views Asked by At

So I have amp almost completely implemented on my site, but I am currently stuck on finishing up the EU-Cookie consent stuff. Right now I am using an amp-user-notification to show the user a notification in the bottom corner of the screen that cookies are being tracked. I have a data-show-href configured and working to check a cookie that I am trying to set in the data-dismiss-href handler.

Inside the data-dismiss-href I am simply calling a .net httphandler that sets a cookie, sets the headers for the response and writes a blank response ( since Google states in their docs that it doesn't expect anything back).

The issue is actually when I click the dismiss button first it makes a POST request to the url i gave, it sets the cookie, and the response is written as a 200 OK. BUT THEN another POST request is made to the actual page that the user is on for some reason, which is causing the following error:

Failed to parse response JSON: SyntaxError: Unexpected token < in JSON at position 0​​​

of course this is because the POST request to the page is returning HTML, not JSON data. So i am not sure why it is making this second POST request. Any ideas?

0

There are 0 best solutions below