PluginProbe
Mailchimp List Subscribe Form / 1.5
Mailchimp List Subscribe Form v1.5
1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 All 55 releases
mailchimp / mailchimp.js

mailchimp.js in Mailchimp List Subscribe Form 1.5, at mailchimp.js

39 lines 994 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /* Form submission functions for the MailChimp Widget */
2 ;(function($){
3 $(function($) {
4 // Change our submit type from HTML (default) to JS
5 $('#mc_submit_type').val('js');
6
7 // Attach our form submitter action
8 $('#mc_signup_form').ajaxForm({
9 url: mailchimpSF.ajax_url,
10 type: 'POST',
11 dataType: 'text',
12 beforeSubmit: mc_beforeForm,
13 success: mc_success
14 });
15 });
16
17 function mc_beforeForm(){
18 // Disable the submit button
19 $('#mc_signup_submit').attr("disabled","disabled");
20 }
21 function mc_success(data){
22 // Re-enable the submit button
23 $('#mc_signup_submit').removeAttr("disabled");
24
25 // Put the response in the message div
26 $('#mc_message').html(data);
27
28 // See if we're successful, if so, wipe the fields
29 var reg = new RegExp("class='mc_success_msg'", 'i');
30 if (reg.test(data)){
31 $('#mc_signup_form').each(function(){
32 this.reset();
33 });
34 $('#mc_submit_type').val('js');
35 }
36 $.scrollTo('#mc_signup', {offset: {top: -28}});
37 }
38 })(jQuery);
39