i have written code to get max data from database and then insert that data in another table but it is not giving data first time.it is giving leadid as undefined because it is not waiting result of getMaxLeadId and executing second statement.my code is given below
var leadId = getMaxLeadId();
alert("leadId"+leadId);
function getMaxLeadId() {}
和
function getMaxIdData_success(tx, result){}
在我需要调用插入maxLeadId
插入函数之后。
请建议我一些想法如何在 java Script 中编写回调函数。