javascript - Error in authenticating the database in sqlite using jquery -


I have created a login page with a username and password and if I click on the login button it should check if The entered username and password match the database (websql) and if it is successful, then go to the next page

HTML:

  & lt; Label for = "uname" & gt; Username: & lt; / Labels & gt; & Lt; Input name = "uname" type = "text" id = "user name" placeholder = "your username" size = "20" maximum length = "20" width = "20" /> & Lt; Label = "pass" & gt; Password: & lt; / Labels & gt; & Lt; Input name = "password" type = "password" id = "pass" placeholder = "your password" size = "20" maximum length = "20" width = "20" /> & Lt; A href = "page3.html" type = "submit" class = "ui-btn ui-btn-inline ui-corner-all ui-btn-b" id = "check" onclick = "login record ()" ; & Lt; / A & gt; Check;  

Jquery function

  $ (document) .ready (function () {$ ("# check"). ( Login register);}); Val (); Var pwd = $ ('# pass'). Val (); Var x = 'SELECT * function log-in record () {db.transaction (function (tx)} {var user = $ (' # user name)) Username = "+ user +" and login table tx from login table. {Var length = result .rows.length; for (i = 0; i & lt; rows.length; i ++) to obtain username and password from executeSQL (x, [], function (tx, result) {Var res = result.rows.item (i); var user name = res.username; var password = res.password;} alert ("user name:" + username "; warning (" password: "+ password) ; // $ ("#Us Html (username); // $ ("#pass") .HTML (password);});})}}  

Is it true or me Some additional methods or steps should be used

If this is not correct, then I may use jquery to codify the user name and password in sqlite

Try to use the following:

  var x = " Select * WHERE username from login = '"+ user +" 'And password =' ​​"+ PWD +" '; Tx.executeSql (x, [], function (tx, result) {if (result.rows.length> gt; 0) {Warning ("username:" + result. [0] user name); Warning ( "Password:" + results. [[0]. Password);} and {warning ("user not found!")}}});  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -