$("form").submit(function(){
if($("#form").valid()){
$.ajax({
type: "POST",
url: "aith_registration.php",
data: $(this).serialize()
}).done(function(data) {
//console.log(data);
var response = JSON.parse(data);
if(response.status === 'error') {
//console.log(response.error);
M.toast({html: 'Данные уже существуют!'});
} else {
M.toast({html: 'Поздравляю, вы зарегистрировались!'});
//console.log('success');
}
});
return false;
}
});
if (empty($errors)) {
$query = "INSERT INTO `users` (name, login, email, password) VALUES ('$name', '$login', '$email', '$password')";
mysqli_query($link, $query);
mysqli_close($link);
$success = true;
echo json_encode(["status"=>"success"]);
} else {
$success = false;
echo json_encode(["status"=>"error", "error"=>$errors]);
}
/home/index/domains/public_html/all/index2.php:8 Stack trace: #0
/home/index/domains/public_html/index1.php(21): include() #1 {main} thrown in
/home/index/domains/public_html/all/index2.php on line 8