I don’t know if this is the right section for my question, but I didn’t know where to open it.
I have a mailchimp embed form for subscribing, the form works good, but I would like to hide it after someone subscribed. Is there anyway I could know what is the response status from mailchimp server for embeded forms?
It depends on what API your form is calling (the action of the form). For example, if you’re calling the Add to List API, the response is a JSON object as described in the API.
So the action of this form is to post to a remote page. How are you loading this in such a way that it’s not changing the page when someone clicks submit? Iframe?
Oh, I have a section element, but I know how to hide it, I don’t know how to get the response from the request. I want to set a cookie only if the “subscribing” was successful, if the cookie is present I will hide de section.erNewsletter, but I know how to do this.
So the simple answer is you dont, because the form opens a new window rather than firing an AJAX request, and thus it starts a seperate javascript scope you cant see from the original.
Are there ways to do it? Yes. Is it a lot of fuss for little additional gain? Yes.
So the simple response is what you do is you stick a onsubmit= in the end of the form tag and hide the section blindly, on the assumption that the form submission worked as intended.