Ver Mensaje Individual
  #19 (permalink)  
Antiguo 14/02/2014, 08:33
martinpedulla
 
Fecha de Ingreso: septiembre-2013
Mensajes: 87
Antigüedad: 10 años, 7 meses
Puntos: 1
Respuesta: ajax con jquery

Ah, esta bien. pero sigue sin enviarse nada. haber si lo sigo escribiendo mal?

Código HTML:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jqueryui.js"></script>
</head>

<body>
<form name="nombreform" id="form1" method="post" action="insertar.php" class="clase">
<input name="nombre" id = "nombre" type="text" value="">
<input name="apellido" id = "apellido" type="text" value="">
<input name="enviar" id="enviar" type="submit">
</form>



<script type="text/javascript">
$(".clase").submit(function(event){
    event.preventDefault(); //Aquí evito que se haga la redirección
    
   
    //Realizo la petición asíncrona
   
    $.ajax({
        url: $(this).prop("action"),
        data: {nombre: $("#nombre").val(), apellido: $("#apellido").val()},
       
    });
});
</script>
 
 
</body>
</html>