Skip to main content
deleted 173 characters in body
Source Link
EHerman
  • 999
  • 2
  • 16
  • 33

I ended up going with:

if(response.indexOf('Everything\'s Chimpy!') > -1) {

} else {

}

and it works like a charm. Thanks for the responses!

I ended up going with:

if(response.indexOf('Everything\'s Chimpy!') > -1) {

} else {

}

and it works like a charm. Thanks for the responses!

added 159 characters in body
Source Link
EHerman
  • 999
  • 2
  • 16
  • 33

I ended up going with:

if(response.indexOf('Everything\'s Chimpy!') > -1) {

} else {

}

and it works like a charm. Thanks for the responses!

I ended up going with:

if(response.indexOf('Everything\'s Chimpy!') > -1) {

} else {

}

and it works like a charm. Thanks for the responses!

Tweeted twitter.com/#!/StackWordPress/status/436585837414084608
improve code formatting
Source Link
fuxia
  • 107.1k
  • 38
  • 255
  • 459
jQuery.ajax({
                            type: 'POST',
                            url: ajaxurl,
                            data: {
                            action:     action: 'chimp_form',
                                form_action: 'validate_api_key',
                            api_key:    api_key: apiKey,
                                data_center: dataCenter
                            },
                            success: function(validation_response) {
                                // alert(validation_response);
                                if(validation_response == "Everything's Chimpy!") {
                    jQuery('.mailChimp_api_key_preloader')
                jQuery('.mailChimp_api_key_preloader').fadeOut('fast', function() {
                    jQuery('.mailChimp_api_key_validation_message')
                        jQuery('.mailChimp_api_key_validation_message').html('<img src="/images/mc-checkmark.png" alt=message > Valid API Key').css("color", "green").fadeIn();
                                   .css("color", }"green").fadeIn();
                        });
        } else {
                                    // alert(response);
                    jQuery('.mailChimp_api_key_preloader')
                jQuery('.mailChimp_api_key_preloader').fadeOut('fast', function() {
                    jQuery('.mailChimp_api_key_validation_message')
                        jQuery('.mailChimp_api_key_validation_message').html('<img src="/images/yikes-mc-error-icon.png" alt=message > Error: '+validation_response+'.').css("color", "red").fadeIn();
                                   .css("color", }"red").fadeIn();         
                });     
                          
        };
                            },
                            error: function(response) {
                                alert('There was an error processing your request...'); 
                            }
                        });
jQuery.ajax({
                            type: 'POST',
                            url: ajaxurl,
                            data: {
                                 action: 'chimp_form',
                                form_action: 'validate_api_key',
                                api_key: apiKey,
                                data_center: dataCenter
                            },
                            success: function(validation_response) {
                                // alert(validation_response);
                                if(validation_response == "Everything's Chimpy!") {
                                    jQuery('.mailChimp_api_key_preloader').fadeOut('fast', function() {
                                        jQuery('.mailChimp_api_key_validation_message').html('<img src="/images/mc-checkmark.png" alt=message > Valid API Key').css("color", "green").fadeIn();
                                    });
                                } else {
                                    // alert(response);
                                    jQuery('.mailChimp_api_key_preloader').fadeOut('fast', function() {
                                        jQuery('.mailChimp_api_key_validation_message').html('<img src="/images/yikes-mc-error-icon.png" alt=message > Error: '+validation_response+'.').css("color", "red").fadeIn();
                                    });                             
                                 };
                            },
                            error: function(response) {
                                alert('There was an error processing your request...'); 
                            }
                        });
jQuery.ajax({
    type: 'POST',
    url: ajaxurl,
    data: {
        action:      'chimp_form',
        form_action: 'validate_api_key',
        api_key:     apiKey,
        data_center: dataCenter
    },
    success: function(validation_response) {
        // alert(validation_response);
        if(validation_response == "Everything's Chimpy!") {
            jQuery('.mailChimp_api_key_preloader')
                .fadeOut('fast', function() {
                    jQuery('.mailChimp_api_key_validation_message')
                        .html('<img src="/images/mc-checkmark.png" alt=message > Valid API Key')
                        .css("color", "green").fadeIn();
                });
        } else {
            // alert(response);
            jQuery('.mailChimp_api_key_preloader')
                .fadeOut('fast', function() {
                    jQuery('.mailChimp_api_key_validation_message')
                        .html('<img src="/images/yikes-mc-error-icon.png" alt=message > Error: '+validation_response+'.')
                        .css("color", "red").fadeIn(); 
                });                              
        };
    },
    error: function(response) {
        alert('There was an error processing your request...'); 
    }
});
Source Link
EHerman
  • 999
  • 2
  • 16
  • 33
Loading