How can i implement a callback function to check whether a CRUD operation is finished or not ? In my app, i'm deleting a table first. After deleting, i want to do some specific tasks. if the delete process is done, i want to do something. If not done (exception occurs) then i want to do something else. Below is my deleting function code. Now what should i add/change to this to implement a callback function after deleting and checking whether the delete process is completed or not ?
function deleteTable(query) { var db = Titanium.Database.open('Horsecount'); var isDeleted; try { db.execute('BEGIN'); isDeleted = db.execute(query); db.execute('COMMIT'); } catch(e) { alert(e); } finally { db.close(); } if(isDeleted){ Ti.API.info('success'); }else { Ti.API.info('fail'); } }and calling this function from outsider as -
deleteTable('DELETE FROM ToDoList');