我需要匹配我在数据库中获取的用户名和密码。现在的问题是我无法匹配您在下面看到的图像的用户名和密码:
这是我的代码如下:
HTML
<body>
<div class="container box">
<div class="form-group">
<h3 align="center">Live Username Available or not By using PHP Ajax Jquery</h3><br />
<label>Enter Username</label>
<input type="text" name="username" id="username" class="form-control" />
<input type="password" name="password" id="password" class="form-control" />
<span id="availability"></span>
<br /><br />
<button type="button" name="register" class="btn btn-info" id="register" disabled>Register</button>
<br />
</div>
<br />
<br />
</div>
</body>
jQuery 脚本- 这是在用户名和密码匹配或不匹配后显示匹配可用性的地方
<script>
$(document).ready(function(){
$('#username, #password').blur(function(){
var username = $('#username').val();
var password = $('#password').val();
$.ajax({
url:'check.php',
method:"POST",
data:{user_name:username, password:password},
success:function(data)
{
console.log(data);
if(data != '0')
{
$('#availability').html('<span class="text-danger">Username and Password not Match</span>');
$('#register').attr("disabled", true);
}
else
{
$('#availability').html('<span class="text-success">Username and Password Available</span>');
$('#register').attr("disabled", false);
}
}
})
});
});
</script>
拉莫斯之舞
慕莱坞森
叮当猫咪