Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/01/2012, 14:26
augusto_jaramil
 
Fecha de Ingreso: junio-2004
Ubicación: Ciudad de Panama
Mensajes: 551
Antigüedad: 19 años, 11 meses
Puntos: 8
Pregunta Envio formularios JQuery+PHP... problema

Companeros.....

Con la novedad de que este par de codigos me canciona como medio regular...

Este es el html (prueba1.html) que hace llamado a un programa php (prueba1.php)
Código HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
	<head>
		<title>Modulo Recursos Humanos</title>
		<meta http-equiv="content-type" content="text/html;charset=utf-8">
		<script type="text/javascript" src="js/jquery.js"></script>
                <script src="js/jquery-validation-1.9.0/jquery.validate.js" type="text/javascript"></script>

<script>
		// initialise plugins
		$(function(){
                $.validator.setDefaults({
	                submitHandler: function() {
                                   $().ajaxStart(function() {
                                            $("#result").hide();
                                   }).ajaxStop(function () {
                                            $("#result").fadeIn("slow");
                                   });

                                   $("#formInfper").submit(function() {
                                            $.ajax({
                                                 type: "POST",
                                                 url: $(this).attr("action"),
                                                 data: $(this).serialize(),
                                                 success: function(data) {
alert(data);
                                                       $("#result").html(data);
                                                 }
                                            });
                                            return false;
                                   });
                        }
                });

                $("#formInfper,#formEstudios").validate({
                     rules: {
                         nombres: "required",
                         apellidos: "required",
                         direccion: "required",
                         },
                     messages: {
                         nombre: "Indique su nombre",
                         apellidos: "Indique su apellido",
                         direccion: "Indique direccion",
                     }
                })

                var fondoOrig = "";
                $(":button").click(function() {
                   posicion = $(this).attr("name");
                })
                $(":button").mouseenter(function() {
                   fondoOrig = $(this).css("background-color");
                   $(this).css("background","blue");
                })
                $(":button").mouseout(function() {
                   $(this).css("background-color", fondoOrig);
                })

                $("#hojavida1,#hvestudios" ).delegate( "*", "focus blur", function( event ) {
                    var elem = $( this );
                    setTimeout(function() {
                       elem.toggleClass( "focused", elem.is( ":focus" ) );
                    });
                });

            })

</script>

    <style type="text/css">
    .boton1 {
        background-color: #6895CC;
        height: 25px;
        font-size: 10pt;
        font-weight: bold;
        color: #FFFFFF;
        border-style: solid;
        border-width: 3;
        -moz-border-radius:7px;
    }
    .boton0 {
        background-color: #CFDEFF;
        height: 25px;
        font-size: 10pt;
        font-weight: bold;
        color: #FFFFFF;
        border-style: solid;
        border-width: 3;
        -moz-border-radius:7px;
    }

    .focused {
       background-color: blue;
    }

/**********************************

Use: Main Screen Import

***********************************/

@import "reset.css";
@import "core.css";

@import "cmxformTemplate.css";
@import "cmxform.css";
    </style>
</head>
<body>
	<form id="formInfper" name="formInfper" method="post" action="prueba1.php">
		<div id="opciones" style="display:block">
		<table align="left" width="90%" border="0">
		<td align="left">
                   <input type="submit" value="Informacion Personal" name="infper" id="infper" onkeypress="return handleEnter(this, event)" class="boton0">
                   <input type="submit" value="Educacion Formal" name="edufor" id="edufor" onkeypress="return handleEnter(this, event)" class="boton1">
                   <input type="submit" value="Idiomas y Edicacion No Formal" name="edunofor" id="edunofor" onkeypress="return handleEnter(this, event)" class="boton1">
                   <input type="submit" value="Experiencia Laboral" name="experiencia" id="experiencia" onkeypress="return handleEnter(this, event)" class="boton1">
                   <input type="submit" value="Referencias Laborales" name="reflaborales" id="reflaborales" onkeypress="return handleEnter(this, event)" class="boton1">
                   <input type="submit" value="Referencias Personales" name="refper" id="refper" onkeypress="return handleEnter(this, event)" class="boton1">
               </td>
               </table>
               </div>
<br></br>
                <div id="hojavida1" style="width:1410px; height:500px; -moz-border-radius:20px; background-color:#6895CC;display:block">
<br>
		  <table border="0">
			<tr>
				<td>Nombre: <input type="text" class="required" id="nombre" name="nombre"></td>
			</tr>
			<tr>
				<td>Apellidos: <input type="text" class="required" id="apellidos" name="apellidos"></td>
			</tr>
			<tr>
				<td>Direccion: <input type="text" class="required" id="direccion" name="direccion"></td>
			</tr>
		</table>
		</div>
	</form>
</body>
<html> 
Este es el codigo php (prueba1.php)

Código PHP:
<?
echo "Datos recibidos Ok";
print_r($_POST);
?>
La vaina es la siguiente:

1. Para que haga el primer llamado a prueba1.php debo hacer doble click en el boton "Educacion Formal"
2. Si hago nuevamente click en ese boton recibo 2 veces la respuesta de prueba1.php (servidor).
3. Si hago nuevamente click en cualquier boton (ya van 4 clicks) recibo 3 veces la respuesta de prueba1.php y si de nuevo hago click obtengo 4 respuestas....

Como le hago para que, asi le haga metecientos mil clicks, recibir solo una respuesta?

Me imagino que ha de faltarme algo.... pero uno como primiparo en el tema no se que sera....

Gracias de antemano por su ayuda


Un Cordial Saludo