
tengo este script jquery
Código:
$(function(){
$("#formulario").submit(function(){
$.ajax({
url:"recibirForm.php",
type:"POST",
data: $("#formulario").serialize(),
success:function(data){
$("#contenido").html(data);
},
error:function (){
alert("Datos no enviados Correctamente");
}
});
});
});
formulario.php
Código HTML:
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Probando</title> <script type="text/javascript" src="../../js/jquery-1.8.2.js"></script> <script type="text/javascript" src="ajax.js"></script> </head> <body> <div id="contenido" style="border: solid black 1px;"></div> <form style="width: 25%;" id="formulario"> <fieldset> <legend>Probado codigo</legend> <label>Nombre</label><input type="text" name="Nombre" id="nombre"/><br/> <label>Edad </label><input type="text" name="Edad" id="apellido"/><br/> <input type="submit" value="Enviar" id="Enviar"/> </fieldset> </form> <?php // put your code here ?> </body> </html>
Código PHP:
<?php
@$Nombre = $_POST["Nombre"];
@$Edad = $_POST["Edad"];
echo "Gracias por enviar tus datos: Nombre ".$Nombre." y su edad ".$Edad;
?> Se los agradeceria muchisimos si alguien me pudiera dar un mano....SALUDOS


