Home > front end >  JS, how to realize the login password verification account password has been saved in the database
JS, how to realize the login password verification account password has been saved in the database

Time:10-01

New HTML and js to do a website homework
Do a simple login function but does not validate database account password please advise
Window. The onl oad=function () {
Document. The getElementById (' logBtn). AddEventListener (' click ', function () {
Var username=document. GetElementById (" user "). The value;
Var password=document. GetElementById (" PWD "). The value;
If (username=='admin' & amp; & Password=='password') {
Window. The location. Href='https://www.baidu.com/';
}
The else {
Alert (' user name or password error! ');
}
});
}

CodePudding user response:

Database on the server side, want to use the form form elements or ajax to submit the user name and password to the server, query the database on the server side validation, again or return the result to the front page,