-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathleadspend.jsonp.js
More file actions
30 lines (27 loc) · 892 Bytes
/
leadspend.jsonp.js
File metadata and controls
30 lines (27 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* LeadSpend Validation Javascript V2.1
*
* Dependencies:
* jQuery: https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
* jQuery-JSONP: https://github.com/jaubourg/jquery-jsonp
*/
if (typeof LeadSpend == 'undefined') {
/* Establish namespace for future use */
var LeadSpend = new function() {
/* Expose validation function */
this.validate = function(emailAddress, timeoutInSeconds, callback) {
jQuery.jsonp({
emailAddress: emailAddress,
url: "https://primary.api.leadspend.com/v2/validity/" + encodeURIComponent(emailAddress) + "?timeout=" + timeoutInSeconds,
callbackParameter: "callback",
timeout: timeoutInSeconds * 1000,
success: function(data, status) { callback(data); },
error: function(xOptions, textStatus) {
callback({
address: xOptions.emailAddress,
result: "unknown"
});
}
});
};
};
}