Skip to content

LeadSpend/jquery-leadspendemail

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 

Repository files navigation

LeadSpend Email Validation jQuery Plugin

Validate your email addresses without writing a single line of code!

The LeadSpend Email Validation jQuery Plugin automatically validates email addresses as soon as they are typed in, and is designed to work well with your current site no matter how you're validating the form.

LeadSpend uses domain-based authentication, so this will not work on your site until we have authorized your domain. Contact us for more information.

Zero-Configuration Usage

This plugin was designed to work right out of the box with zero-configuration. All you need to do is:

Include jquery:

 <script type="text/javascript" src="//code.jquery.com/jquery-1.9.1.js"></script>

Import jquery-leadspendemail:

 <script type="text/javascript" src="../../jquery.leadspendemail.js"></script>

Add the class "leadSpendEmail-noconfig" to the email input on your form:

 <input class="leadSpendEmail-noconfig" name="email-input">

The LeadSpend result will appear in a hidden input on your form, available to use with your current form validation.

Custom Usage and Options

LeadSpend Email Validation is also a fully featured jQuery plugin. This means that it is called using a jQuery selector, and can be passed a map of options, or PlainObject. To use custom options, remove the "leadSpendEmail-noconfig" class from your email input and call the plugin directly:

$(function(){
  $('{email-input-selector}').leadSpendEmail( options );
});

Options

The following options may be passed to the plugin:

ValueDescriptionTypeDefault Value
timeoutThe timeout, in seconds.Integer from 3 to 155
debugEnables console logging.Booleanfalse
delaySubmitDelays form submit until the API call returns.Booleantrue

Accessing the Result

The email validation result will be stored in a hidden input as part of your form. This input will have the following attributes:

  • name = "{name of your email input}-result"
  • id = "{id of your email input}-result" (or "" if ID was not set on your form)
  • class = "leadSpendEmail-result"

When a result is returned, the "change" event is triggered on the hidden result input.

The easiest way to access this value in JavaScript will be to use jQuery:

var result = $("#{id of your email input}-result").val();

The result will also be available server-side:

$result = $_GET["{name of your email address input}-result"];

Result Codes and What They Mean

LeadSpend defines the validity of an email address as follows:

ValueDescription
verifiedMailbox exists, is reachable, and not known to be illegitimate or disposable.
disposableDomain is administered by disposable email provider (e.g. Mailinator).
unreachableDomain has no reachable mail exchangers (see discussion, below).
illegitimateSeed, spamtrap, black hole, technical role account or inactive domain.
undeliverableMailbox or domain does not exist, or mailbox is full, suspended or disabled.
unknownWe were unable to conclusively verify or invalidate this address.

More detail can be found at our API Documentation.

In addition to these result codes, this plugin defines two status codes as follows:

ValueDescription
pendingThe email validation API call has not yet completed.
errorThere was an error while making the API call to the LeadSpend servers.

Demo Forms

Included in the demo folder are a variety of pages which demostrate usage of the LeadSpendEmail plugin. These fall into two categories:

Standalone

Various configurations of the plugin, by itself. This is the place to start if you plan on using the plugin with your existing front-end or server-side form validation.

  • automatic.html: Fully-automatic, out of the box configuration. Automatially delays form submission until the API result has returned.
  • custom.html: Demonstrates passing basic configurations to the plugin, such as debugging, timeout and turning off delaySubmit.

jQuery Validate

Demonstrates the use of the plugin in conjunction with jQuery Validate. If you have no existing validation on your form or would like to quickly add very good JavaScript validation, this is for you. jQuery Validate is an extremely powerful tool that allows you to add specific validation controls to your form by simply adding CSS classes. Find out more in the jQuery Validate documentation.

  • automatic.html: Fully-automatic, out of the box configuration using the zero-configuration jquery.leadspendemail.js in conjunction with jQuery Validate. Includes a script which configures jQuery Validate for fully automatic form validation.

About

LeadSpend jQuery extension (JSONP implementation)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 68.1%
  • HTML 31.9%