This is my AJAX
..
<!-- CREATE AJAX -->
<script type="text/javascript">
$(document).ready(function(){
$('#create').click(function(event){
event.preventDefault();
$.ajax({
url: "usuario_registrado.php",
method: "post",
dataType: "text",
data:$('form').serialize(),
success: function(resultado){
if($error_enviado == true){
$('#mensaje').html("<p>"+resultado+"</p>")
}else{
$('mensaje').html("<p>"+resultado+"</p>")
}
}
});
})
});
</script>
and this my php ..
<?php
include("includes/motor.php");
$users = new Usuarios();
if ($_POST) {
$nombre = $_POST['nombre'];
$apellido = $_POST['apellido'];
$email = $_POST['email'];
$nacimiento = $_POST['fecha'];
$telefono = $_POST['telefono'];
$usuario = $_POST['user'];
$privilegio = $_POST['privilegio'];
$clave1 = $_POST['clave1'];
$clave2 = $_POST['clave2'];
$error_enviado="";
$error_pass ="";
if($nombre == "" || $apellido == "" || $email == "" || $nacimiento == "" || $telefono == "" || $usuario == "" || $privilegio == "" || $clave1 == "" || $clave == ""){
echo "<div class='alert alert-danger text-center' role='alert' style='padding:10px;'>¡Debes rellenar todos los campos!</div>";
?>
I want that if the condition is fulfilled, print me a message, but, do another .. but all using my ajax