JQuery MailChimp context

I had the most AWFUL time integrating MailChimp into the site that I am developing!

The problem is that validation does not work for the inline subscription form. Instead of inserting error messages, the form sends the user to the MailChimp registration page to correct errors or confirm the selection.

I made a large number of settings for the code, so, unfortunately, returning to the default is not an option.

Here are the errors that I get, but I'm JS n00b, so I don't know what they mean:

Error passing mce_jQuery not defined:

Screen shot 2010-08-22 at 4.34.50 AM.jpg

I do not think that this is a mistake that can be caught using the console.

This is strange. If I rip out the user code and just send the static code from MailChimp, it somehow works, but I copied all the relevant code with important functions and still not cubes.

You can view the site live: http://ranya.net/wp/contact

Registering the MailChimp list is in the drop-down list of the upper right corner. Corresponding scripts are embedded right after div # top_mailing.

+6
javascript debugging conflict mailchimp
source share
5 answers

Alec Smart's answer was ALMOST correct. When running jQuery in NoConflict mode, the problem was resolved. Alec suggested adding jQuery.noConflict (); in the title of the document. It turns out there is a line in the code to insert MailChimp that is commented out. To properly enable noConflict mode to search for MailChimp script for

//var mce_jQuery = jQuery.noConflict(); 

Delete the comment so it looks like

  var mce_jQuery = jQuery.noConflict(); 

and then you should be good to go! :)

+1
source share

Or you can just rename this variable to mailChimp.js:

 var mce_jQuery = jQuery.noConflict(); 

to

 var mce_jQuery = jQuery; 

I don’t know why MailChimp developers decided to rewrite the dollar sign using the method.

+3
source share

Using jquery 1.8.1 and the latest mailchimp code from 28 to 2013

I could not find the above comment to uncomment it.

However, I could see this mailchimp code:

 function mce_init_form(){ jQuery(document).ready( function($) { 

My understanding of this is not very great, but it reassigns the default jquery $ variable.

However, later in the code was the following:

 function mce_success_cb(resp){ $('#mce-success-response').hide() 

which disabled mailchimp code up

I changed it to

 function mce_success_cb(resp){ jQuery(document).ready( function($) { $('#mce-success-response').hide(); 

and it works. I’m not quite sure why (and I would like to explain the explanation!), But I thought I would send it, because someone might encounter this issue in the same way as I do.

+2
source share

I was not lucky with any of the above solutions, probably because the last answer is more than a year old and it no longer reflects the current mailchimp code.

To resolve jQuery conflicts, I copied the mc-validate.js script that MailChimp serves from http://s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js and puts it on its own server. Then I decorated it and removed the jquery code from the file. Thus, now only our version of jquery remains on our server, and nothing else conflicts.

What it looks like, you also won’t need the string var $mcj = jQuery.noConflict(true); .

@mailchimp: a great solution to this problem would be if you could just provide a different version of the code on your amazon servers that doesn't include jquery.

+2
source share

Try moving this code to the top right (for example, right after the <head> ):

 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script> <script>jQuery.noConflict();</script> <script type="text/javascript" src="http://downloads.mailchimp.com/js/jquery.validate.js"></script> <script type="text/javascript" src="http://downloads.mailchimp.com/js/jquery.form.js"></script> 
+1
source share

All Articles