How can I display the response of a MailChimp form

2019-08-03 20:59发布

问题:

I currently have a standard form for users on my site to signup for our mailing list:

<form class="form-stacked" action="http://coworkDF.us2.list-manage.com/subscribe/post" method="post">
<input class="span3" id="MERGE0" name="MERGE0" type="email" autocapitalize="off" autocorrect="off" placeholder="e-mail">
<input type="submit" class="btn float-right mail-send" value="Enviar">
</form>

Instead of redirecting them to the confirmation page, I'd love to display that confirmation in a modal box without leaving the page. I'm using the Twitter Bootstrap toolkit to build the site... they have a nice modal box utility but I'm not sure how to combine that with the MailChimp form.

Any thoughts? Thanks in advance

回答1:

Just in general terms, you need to submit the signup request via ajax so that you stay on the current page, then extract relevant pieces from the response and use them to populate your modal.