mercredi 30 mars 2016

login function dosent work with me

I have the following code but it dosent work and i dont know where the error is

        var username= document.getElementById("demo-Username").value;
        var password= document.getElementById("demo-Password").value;

        alert(username);
     db.transaction(function (tx) {
     alert("before select");
        tx.executeSql("SELECT * FROM user WHERE username=? AND password=?",[username,password],function (tx,results){
        alert("after select");
           var len = results.rows.length, i;
                if(len>0){
                    alert("Welcom");
                }else {
            alert("ERROR USERNAME OR PASSWORD");
           }

        }, null);
     });

it works until reach to the select statement and stop working, if i remove the function that located after the select statement it works and the same thing if i remove the select statement and keep the function it also works but when i put them together it will stop executing in select statement.

anyone know what the error here ?

Aucun commentaire:

Enregistrer un commentaire