This is a common problem that is easily solved by making sure that the PHP constructor (i.e. new TableGear()) comes before any HTML or other character data in your PHP document. Any HTML that comes before that line will get mixed into the JSON output, which will cause a Javascript error on update.
Note: To alleviate any confusion, this is the PHP constructor that must come before any output. The Javascript constructor you can place anywhere in the page (after the table).
error_reporting(E_ERROR);
If you need to, you can turn on more strict error reporting after TableGear has finished processing."database" => array(..."columns" => array("ONE", "TWO", "THREE)...)
$tg->fetchDataArray("SELECT * FROM table WHERE price < 2 LIMIT 10");
One caveat: you must set your database primary key field in the "database" parameter of the constructor or functionality will break! Also, it is a good idea to set database["noAutoQuery"] to true to avoid the initial query, which will fetch everything by default.