沧海一幻觉
您需要在click事件结束时返回false$(document).ready(function() {$("#register").click(function() {
var name = $("#name").val();
var email = $("#email").val();
var password = $("#password").val();
var cpassword = $("#cpassword").val();
if (name == '' || email == '' || password == '' || cpassword == '') {
alert("Please fill all fields...!!!!!!");
} else if ((password.length)
alert("Password should at least 8 character in length...!!!!!!");
} else if (!(password).match(cpassword)) {
alert("Your passwords don't match. Try again?");
} else {
$.post("register.php", {
name1: name,
email1: email,
password1: password }, function(data) {
if (data == 'You have Successfully Registered.....') {
alert("Tu cuenta de usuario ha sido creada");
}
});
}
return false; // put this it will solve your problem});});