i am running an sql query in an loop . the query should run only if the loop count is equal to 500 .
for E,g
$.ajax({
response:function(e){
// Here e.length will be unknown
for(var i in e){
if(q1cnt <= 500){
// do some appending
var k = k + 1 ;
if(q1cnt == 500){
tx.executeSql(k);
}
}
}
}
})
In the above case i want to execute an sql operation if the count reaches 500 , my problem is if the length of response is 1344 for first two 500 it will be okay but how can i call tx.executeSql(k); at the end of 433 items.