background top

An oldschool way to debug AJAX

If you’ve ever worked with AJAX then you can probably relate. When it comes to debugging complex problem over AJAX it can be difficult to pinpoint the problem. For example if the AJAX call is failing to retain the session or something similar it can be very difficult to determine why. Often we might look at the AJAX debug information built into most libraries but that won’t necessarily point you in the write direction. The AJAX debug information may prove to be no help at all if the calls back to the server are failing before the execution of your AJAX functions.

For a solution to this problem - look back and go simple. Debug the problem by outputting information to a file on the server. Write out all the session information, and record the passed data. Doing this will hopefully save you some time and frustration if you’re having problems with debugging AJAX.

One Response to “An oldschool way to debug AJAX”

  1. Jeremy Says:

    I ran into this specific problem the other day in Coldfusion. What I needed to be able to do is use a CFDUMP to find out what was in a query. Obviously like you mentioned you can’t just dump an AJAX call. So I decided to follow your advice and write it to a file. What I ran into though is I didn’t know how to capture the output of a CFDUMP.

    Did a quick search - CFSAVEOUTPUT was the answer. CFSAVEOUTPUT will save the output of whatever content you put between the start and end tags to a variable, which you specify as an attribute. Then I could just use CFFILE to output that variable to a file.

    Finally a way to debug AJAX in Coldfusion.

Leave a Reply