We’ve recently revised our original AJAX subscribe form to make it even easier to add to your sites. All you have to do is take the subscribe form as generated from within your account and follow some simple instructions to get it to work. The result is a form which does not require a new page to be loaded after subscribing to an existing list, meaning faster signups and no need to redirect subscribers to a subscription confirmation page. There’s even email address validation built in, so your lists don’t get filled up with junk data.

Since version 1 of the AJAX form, we’ve made some pretty substantial improvements, such as cutting out server-side scripting and ensuring you don’t have to tweak the default subscribe form code in order to get it to work. As straightforward as the end result is, we still recommend having a basic understanding of CSS and JavaScript in order to use and customize the form to your liking.

You can find details on how this form works on our AJAX subscribe form page. Should you have any questions in regards to using this code, feel free to post away on our API Developer forum. Happy AJAX subscribing!

  • Ian Atkins

    Nice work, much cleaner.

  • Jusitn V

    Fantastic. Easy to implement and works great, thanks!

  • Okke

    Thanks for the new, clean code. Works perfect.

    One small thing; when I change the type of the input from “text” to the HTML5 type “email”, the form keeps returning an “Error: Invalid e-mail address”…

    Any reason the type=”email” isn’t supported jet?

  • James Dennes

    Thanks guys – glad this is helpful.

    Okke, I can’t think of a reason why your browser wouldn’t send our tracking servers the value of that field if you use type=”email”. I’ve successfully tested this myself in a few different browsers.

    If you’re still having a problem using type=”email”, please feel free to post your question in the forums, with details such as your form markup and the browser you’re testing this in.

  • Lauren

    I can’t get this to work… is there another step beyond copying and pasting the JavaScript after my existing sign-up code?

  • Gareth

    There shouldn’t be. Are there any errors in the console Lauren?

  • Luke Sturgeon

    I cannot seem to get my custom field to work using the AJAX form. But if I submit the HTML only form then it works fine.

  • Ketan

    How do you customize the “success” or “failure” message with this approach? Do not see this in your writeup. Thanks!

  • Lauren

    I’m not sure what you mean by errors in the console. I simply added the Javascript above to the existing subscribe form I had, and it’s not working. What else should I be doing?

  • James Dennes

    Hey Lauren,

    The JavaScript selects the form based on the form id “subForm” (as set when you generate a subscribe form through the app). If you have changed this in the form you are using, you will need to adjust the JavaScript to suit that.

    If you’re still having problems getting this working, I would suggest that you get in touch with support, where we’ll be able to look at your specific form and see what the issue is.

  • Lauren

    Thanks, James. I confirmed that I’m using the id “subForm” – I’ve tried it on two of my sites. It’s still not working. I’ll contact support.

  • Tony Loxton

    How would this work if I wanted to have google analytics goals setup for form submissions? Is there way that we can code a goal into this? At present we always send people to a confirmation page and have the goal set as that page’s url.

  • Nickolas Simard

    Good works!
    I also want to know how to customize the “success/failure” message since my website are mostly in French (or bilingual, in which case I still have to customize them :p).

  • JB

    I’m avoiding this, as a “confirmed” page can be tracked by Google Analytics but the Ajax form can’t.

    Or can it? Please prove me wrong!

  • Mathew Patterson

    JB, you can actually track it with Google Analytics – see the note at the bottom of the page here: https://www.campaignmonitor.com/appstore/ajax-subscription-form/

  • D. Hall

    Is it possible to use the AJAX form on a Facebook tab?

  • Ros Hodgekiss

    Hi D Hall, you can potentially use iframes to add a subscribe form to a Facebook tab – here’s a tutorial on this.

    We are working on an email subscribe app for Facebook which should make this process radically easier, so get in touch with us and we’ll keep you updated on its release.

Want to improve your email marketing? Subscribe to get tips on improving your email marketing delivered to your inbox.

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free