App Store

AJAX Subscription Form

Developed by Campaign Monitor

Looking for a way to add subscribers to your lists without having to reload the page? Try this solution using jQuery.


Description

The following offers a way to submit your subscription form via AJAX. This comes in handy when you’d like to add subscribers without having to reload the page, or send them to the default Campaign Monitor confirmation page.

This AJAX subscribe form uses jQuery and JSON to add subscribers to an existing subscriber list without needing to reload the page. On submission of the form, a subscription request is made from your browser to our servers. We reply with a response which includes details of the subscription result. If submission is successful, we show an alert that says, “Success”. If not, an ‘Error’ alert and reason are displayed. Of course, you can change this behaviour to suit your needs.

If you’re fairly experienced with JavaScript, the code should be straightforward to understand, however you’re more than welcome to post any questions you may have on the API developer forums.

The subscription result is a JavaScript object which contains three fields:

  • Status A number representing the subscription status. 200 if subscription was successful, or 400 if subscription was unsuccessful.
  • Message A string containing a message which describes the subscription status.
  • RedirectUrl A string containing a redirect URL, only if subscription is successful and you have set up a redirect URL for the list in your account, otherwise null.

Installation / Documentation

To customize this form you will need a basic understanding of CSS and JavaScript. If you have previously used v1 of this form, you will notice that we’ve removed the need for server-side code.

Here are some quick steps to get you started:

  1. Download/copy the latest version of the code from GitHub
  2. Paste your existing subscribe form in the area designated just after 1. Take your Campaign Monitor subscribe form… in the code. If you don’t yet have a subscription form on your site, here’s how to get one.
  3. Add this combined code to your site and voila, your form should submit via AJAX.
  4. Now feel free to customize everything to fit your needs.

After you paste in your subscription form, the script should be ready to use. We’ve tried to make this process as easy for you as possible.

Download
Price: Free
Developer: Campaign Monitor
Contact: Contact support

Recommended apps

AddThis Developed by AddThis Use AddThis website marketing tools to gain more Campaign Monitor subscribers through personalized call to actions.
Mob.is.it Developed by Mob.is.it Easily and quickly integrate your mobile forms, coupons or contact pages with Campaign Monitor lists.
Scroll Box Developed by SumoMe Add a fully customizable, beautiful, behaviorally-triggered popup box to your website with this tool from SumoMe.

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