ColdFusion debugging breaks jQuery AJAX calls
This may be a no-brainier for some, but I fought with it for about 2 hours yesterday so I wanted to make note of it in case it happened again.
I had a situation where my code worked correctly on my local development machine, but wouldn't work in our staging environment. The exact problem was that I was using jQuery to call a CFC, which returned some JSON, and jQuery then populated a div with it. Pretty basic stuff. But for some reason, on our staging server jQuery encountered problems and would never populate the div, even though I could see in FireBug where the CFC call was returning the JSON correctly. All code was identical in every comparison, and both sites were using the same database so the data was identical as well.
It took me a while, but I finally figured out what was happening. Long story short, our staging server had CF debugging turned on, and it was appending the debug info to the end of the JSON being returned from my CFC call, which then threw errors in jQuery. Locally I have debugging turned on as well, but it's going to ColdFire/Firebug, so I never saw the problem. The JSON packet being returned is so large that it doesn't show all of it in FireBug, so it wasn't until I opened it in a FireFox tab that I saw the debugging info being appended to the end.
Anyway, a simple "cfsetting showdebugoutput="false"" fixed the issue.


regards,
larry