

Widely-distributed MailChimp Subscribe Form breaks jQuery AJAX functionality - colllin

MailChimp provides their users an HTML Subscribe Form to copy &amp; paste into their website.  This form allows visitors to subscribe to the website&#x27;s mailing list.<p>The copied &amp; pasted form code injects a JS file which overwrites jQuery.ajax() in order to do some custom handling.  This JS file is hosted by MailChimp.<p>Since jQuery 1.5, jQuery.ajax() has accepted two parameters, `url` and `settings`.  The jQuery v1.0 through v1.4.4 API only accepted one parameter, `settings`.  The MailChimp version of jQuery.ajax() also only accepts one parameter, such that any other code in the page that tries to pass two parameters will malfunction.<p>My tiny company is built around a WordPress plugin. It runs in cooperation with JS code written by hundreds of other developers on a daily basis.  Sometimes conflicts arise.  I debug them, and either fix a bug that I wrote and release a new version, or work with the 3rd-party developer to fix a bug that they wrote.<p>I&#x27;ve had several customers complain to me that my plugin doesn&#x27;t work.  I debug their site, find that jQuery.ajax() has been overwritten, trace it back to the MailChimp file, explain that MailChimp has made a mistake, this kind of thing happens all the time, and I will work with them to resolve the issue.<p>I&#x27;ve contacted MailChimp several times about this issue over the past 4 weeks.  In their most recent response, they explained: &quot;That being said, keep in mind that we serve over 3.5 million customers and even the slightest change can have a massive impact if not implemented carefully.&quot;  Apparently they aren&#x27;t concerned about the 3.5 million customers that are potentially being negatively impacted because of careless implementation in the first place (or at least careless maintenance).<p>Suspect MailChimp JS file:
https:&#x2F;&#x2F;gist.github.com&#x2F;colllin&#x2F;6717655#file-jquery-form-n-validate-js-L1683<p>jQuery Docs:
http:&#x2F;&#x2F;api.jquery.com&#x2F;jQuery.ajax&#x2F;
======
colllin
This seems like a gross abuse of power. It's not the size of the problem, it's
the 2nd- and 3rd-tier impacts that concern me. I can't be the first person to
have experienced this problem. Chances are, more experienced developers have
come across it, hacked their code to work, and moved on with their lives. But
less experienced developers have probably suffered frustration and several
wasted man-hours. Their customers likely have more fragile products, delivered
a little less efficiently (or at slightly higher cost).

The solution is so small, too. I've offered my phone number so that I can
brief their developers and help them find a solution. It would take far less
time to solve the problem than it did to write this post.

What else can I do? I can re-write my code to use the older jQuery.ajax() API
and release a new version. But this only covers up their mistake, it doesn't
solve it. And what happens when another towering web business comes along and
writes some code that only supports two parameters for jQuery.ajax().

------
dragonwriter
Do they document an API as well as provide a form, or do they require (perhaps
as part of the ToS) you to use their form? Because, really, its sounds like
the best option is to build your own form against their API, if this is
permitted, rather than using their form.

~~~
colllin
I agree, a developer in 100% control of their site would probably notice
something is wrong and either build their own form, use an unofficial form, or
re-write their ajax calls. There is no requirement to use the official
embedded Subscribe form.

In my case, my product is a WP plugin, so I have relatively little control
over the host site. The MailChimp form makes my product look broken (although
the affected code is perfectly correct).

