Hello dear Hubspotters!
I am trying to use the forms api. Everything is pretty much ok. I am able to submit the form however every time I do a submission in the form analytics I see double submission with the first one being empty, the second one being the submission with the info I provided. What’s your opinion on this? Why does this happen?
Hi Peter, the problem was that when I clicked on my submission button the ajax request was sent twice (because of CORS it sends a preflight request with empty data) I just changed my php to check $json to not be empty.
@Hayk Perfect so are we all set then? That is a good find thanks for posting about the preflight request. Our APIs don’t allow CORS requests as well for the record.
@Hayk Nothing in your code jumps out at me at the moment. Can you log your network traffic in the browser and see if there are any requests being sent out from there? Maybe you can determine if you are calling your PHP script twice.