views:

52

answers:

0

Hi,

I am developing a HTML5 based application. I need to process two queries concurrently, one inside another. Pseudo code attached below:

function main()
{  
    db.transaction(
    function (transaction) {
        transaction.executeSql(getDeptQuery,
            [bind1,bind2],processDepartments, errorHandler);
    }
);
}
function processDepartments(transaction, results)
{
 for (var j=0; j<results.rows.length; j++) 
 { 
  temp += "<div>"+results.rows.item(j).dept+"</div>";  
  transaction.executeSql(getEmpQuery,[bindDept],processEmployees, errorHandler);     
 }
 document.getElementById('mydata').innerHTML +=temp;
}
function processEmployees(transaction, results1)
{
 for (var j=0; j<results1.rows.length; j++) 
 { 
  temp += "<div>"+results1.rows.item(j).empname+"</div>";       
 }
 document.getElementById('mydata').innerHTML +=temp;
}

Can someone help me with the correct syntax for achieving this.

Regards Krishna Neeraja.