Version 2 of the AJAX subscribe form is now available. You can find it here.
Adding a subscribe form to your site has always been a simple matter of pasting some supplied code from your account. Recently we’ve had more and more customers asking how they can go about turning this standard form into an AJAX based form that could submit without refreshing the page.
We’ve just put the finishing touches on a simple code sample you can use to achieve just that. The best part is, we’ve built it so you can just drop in the supplied subscribe code and you’re done. The code will also check to make sure the email address entered is valid before it processes the form. Once a submission has been made, the form will be hidden and a confirmation message shown in its place.
This example was put together using jQuery and PHP. The concept is fairly simple and the code is well commented, so it could easily be adapted to another programming language.
You can copy the code here. Feel free to modify it to suit your needs.
On a side note, this sample code was put together by David Martin, Campaign Monitor’s new designer extraordinaire. You’ll be seeing much more of Dave’s work over the coming months when we release some exciting new features he’s been hard at work on.