0

I have a very simple MailChimp signup form on my site. It’s a text field, and a submit button. I want this to submit without reloading the page, and to have very simple (ie unformatted) error reporting. No fancy floating message bubbles etc.

There is over a decade of posts on this topic, but there are so many variations and complications to them it's hard to work out what is the current best and simplest method. I’m not a programmer, so it’s been very hard to work out what to use.

Does anyone have a definitive example of code that achieves this? I would have thought that given how popular MailChimp is, they would provide their own embed code that does this, but the one I have generated from their site still reloads the page and has ugly error message formatting I can't change.

Glyph
  • 97
  • 2
  • 9
  • Well, it is necessarily going to involve programming, in Javascript. You can have your button trigger a Javascript function instead of posting the form. That function can then run an AJAX POST request to do exactly what the form would have done. – Tim Roberts Aug 30 '23 at 03:13
  • Thanks Tim. I should be clear that I am happy to have a go at programming, in the sense of copying/pasting code and adding API keys or IDs. But I can't program from scratch. I am hoping there is some form code, and a script that I can edit. – Glyph Aug 30 '23 at 03:33
  • This question has a hint on how to use AJAX to submit the fields from a form (https://stackoverflow.com/questions/1229190/jquery-ajax-submit-all-elements-in-form-without-manually-entering-them), but remember, if it's not a well-defined API, what you get back is going to be HTML that you'll have to parse to figure out whether it succeeded or failed. It's not trivial. – Tim Roberts Aug 30 '23 at 03:42
  • Yes this is the rabbit hole I'm trying to avoid. I am hoping there is a plug and play solution for a mailchimp signup form, just given how common it is everywhere, rather needing to cobble together lots of random code to do it. – Glyph Aug 30 '23 at 04:23
  • Well, as a rule, they don't WANT people to sign up automatically. They want you to sign up on their web site so they can upsell their packages. – Tim Roberts Aug 30 '23 at 06:09

0 Answers0