In the function "Encaisser", the value of "i" is OK in the for, but if i call 'i' in a function in my function, "i" return "Undefined.
function Encaisser()
{
for(var i=1; i <= Nombre_ligne_en_caisse; i++)
{
db.transaction(function(t,i){ t.executeSql('SELECT En_cour FROM Sequence WHERE Nom="Ticket_ID"', [], function(tx,rs,i){
var row = rs.rows.item(0);
var Tick_ID = row['En_Cour'];
var Noma = window['Produit_en_caisse_' + i] ;
alert(i); //Undefined
alert(Noma); //Undefined
}, [])});
alert(i); //If i put the alert here, its OK
}
}
Do you know why?
Thank You,