I am successfully getting data from a mysql data base until I try to drop a table. The table drops, but I cannot figure out how to keep the javascript ajax data base access from declaring an error.
How can I return ok, when there is no data to return?
The following php routine deletes a row in the order table followed by dropping the table named $tableNameInput. Inspection of the database reveals that both operations were successfully performed but the javascript ajax error processing is tripped with x.status = 0. I just need a way to tell the javascript ajax that it is really complete.
function dropCartTable($tableNameInput){/* drops the cart table and its order entry*/
AnnLog("dropCartTable: ",$tableNameInput);
// first drop the reference in the orders table
$tableName = "orders";
$query = "DELETE FROM $tableName WHERE cartDB ='$tableNameInput'";
$result = doQuery($tableName,$query, "Could not drop orders row");
if($result){
// now drop this cart table
$sql = "DROP TABLE IF EXISTS $tableNameInput";
}
//********do query just does the query and logs. it does not return if it dies.
$result = doQuery($tableName, $sql, "Can not drop csrt table");
if($result){
/****** when we get to here we have successfully dropped the items. below, I tried to generate a response and it did not work.*/
$arr = array('drop cart' => 0);
$j = json_encode ($arr);
echo \json_encode($j);
AnnLog("echoed ",$j);/* this writes my logs which verify that all steps until the return are ok.*/
}
}
thanks in advance for your help.
echo json_encode($arr);?