Firebug is great for seeing what is being sent and returned when doing
'AJAX' style development (XHR).

However, if you are working on a page that expects a JSON response and
your back end code returns output in addition to the JSON , your client
side Javascript probably won't work as expected because the extra data
invalidates the JSON. I'm working on a project that uses jQuery, and in
my usage I recently experiences this.

The problem was that in this case the additional output was my doing.
I'd put some "write" calls in the code to debug something. Of course I
could have used write to console, but my A4D code is running on 4D
client in a machine in a server room. I wanted to see the output in the
response.

I discovered that you can do a couple of things to fix this.
(1) Return your debugging output in the JSON. The downside of this is
that the debug out is harder to read and may loose any intended formatting.
(2) Output your debugging output inside a Javascript /* */ comment. This
keeps the JSON valid, plus allows you to easily read it in Firebug.

hth,

Brad Perkins

_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to