I am trying to develop a simple login page , using PHP , AJAX and MySql. And after a long struggle , I did this :
<head>
<link rel="stylesheet" type="text/css" href="css\\login.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js">
function do_login()
{
var username=$("#username").val();
var pass=$("#password").val();
if(email!="" && pass!="")
{
$.ajax
({
type:'post',
url:'serveur.php',
data:{
do_login:"do_login",
username:username,
password:pass
},
success:function(response) {
if(response=="success")
{
window.location.href="index.php";
console.log(1);
}
else
{
alert("Wrong Details");
console.log(0);
}
}
});
}
else
{
alert("Please Fill All The Details");
}
return false ;
}
</script>
</head>
</style>
<body>
<div class="login-page">
<div class="form">
<form class="login-form">
<input type="username" placeholder="username" id="text" />
<input type="password" placeholder="password" id="password" />
<button type="submit" id="loginButt" onclick="do_login()">login</button>
<p class="message"><a href="1stPage.html">Go Back</a></p>
<div id="resultat ">Authentification result Here ....</div>
</form>
</div>
</div>
</body>
But I have this error message :
Uncaught ReferenceError: do_login is not defined at HTMLButtonElement.onclick