我想在提交按钮验证后提交表单。验证更正并完成后,错误和警告消失,但此脚本不执行任何操作。我单击提交按钮,它只是没有响应,也没有将任何数据插入数据库。
顺便说一下,我在每个单独的 div 元素中显示了每个输入验证,所以我也不想破坏这种风格。
<script type="text/javascript">
$(document).ready(function(){
$('#submit').click(function(event){
event.preventDefault();
var fullname = $("#fullname").val();
var username = $("#username").val();
var email = $("#email").val();
var password = $("#password").val();
$.ajax({
url: 'registercontrol.php',
method: 'POST',
data: {fullname:fullname},
success:function(response){
$("#vfullname").html(response);
}
});
$.ajax({
url: 'registercontrol.php',
method: 'POST',
data: {username:username},
success:function(response){
$("#vusername").html(response);
}
});
$.ajax({
url: 'registercontrol.php',
method: 'POST',
data: {email:email},
success:function(response){
$("#vemail").html(response);
}
});
$.ajax({
url: 'registercontrol.php',
method: 'POST',
data: {password:password},
success:function(response){
$("#vpassword").html(response);
}
});
});
});
</script>
沧海一幻觉