Firebug with Firefox is an excellent tool for debugging JavaScript.
I have come across instances where the ibm_db2 driver appears to be working but ether return a SQL return code of 0 or segfaults causing an invalid JSON object error. Often this is caused by the driver not being able to find the required DB2 libraries. On UNIX systems the file is libdb2.so.1 and creating a reference to it...