In my website, there is a login button. When a user clicks on that a popup pops up which asks for username and password from a user. Now i want that popup to work like following:
1- if user gives wrong username and password then popup disappears and an alert comes to tell user that wrong username or password is entered. try again.
2- if username and password is right then popup should be disappeard and main page should be redirected to user home page.
How can i do that using javascript.
Thanks in advance.
You’re looking for some Ajax stuff. I think your login data is in a database (if not, then it doesn’t make any sense, because everyone could simply read the login data)
I recommend you to search for some Ajax tutorials. Ajax is a technique to load content dynamically via javascript. Which means: after sending username + password to a server, it will response with success or failure, which you can use on your current page to display the error or success message.
Jquery is an easy-to-use javascript framework, which also supports Ajax calls.