Thursday, June 14, 2007

Help! My AJAX or send_data is failing!

I was running into a problem where I had a graph that was failing in production but worked fine in development. I generate my graphs using Gruff and pipe the data to the output using send_data. Development is WEBrick but production is Apache/FCGI (yes, one day soon we will move to Mongrel).

I discovered that print statements were my problem. If you run into this, delete all print statements from the method that generates the send_data.

I later ran into the same problem with an AJAX function called by form_remote_tag. I used Firebug to isolate but my dev partner had to help me out. Same answer, a stray print statement.

Watch those print statements, especially the ones using the shorthand "p".