Ver Mensaje Individual
  #13 (permalink)  
Antiguo 10/12/2009, 19:41
Avatar de jackson666
jackson666
 
Fecha de Ingreso: noviembre-2009
Ubicación: Buenos Aires, Argentina
Mensajes: 1.971
Antigüedad: 14 años, 6 meses
Puntos: 65
Respuesta: Ayuda con cun form

El check.php

Código PHP:
<?php
$var1
=$_GET['v1'];
$var2=$_GET['v2'];
$var3=$_GET['v3'];

if(isset(
$var1) && isset($var2) && isset($var3)){

#haces todas las comprobaciones que quieras



#al final de todo, si esta bien, mandas la respuesta;

echo "true";

}else{

#si hay algo mal

echo "false";

}
?>
Entonces modificamos el AJAX para que responda a estos valores

Código HTML:
<script language='javascript'>
var xhr;
function startAjax(){
    if(window.XMLHttpRequest){
        xhr=new XMLHttpRequest();
    }else if(window.ActiveXobject){
        xhr=new ActiveXObject("Microsoft.XMLHTTP");
    }
    
var v1=document.getElementById("numerodeinforme").value;
var v2=document.getElementById("fechadeinforme").value;
var v3=document.getElementById("EMfechadeinicio").value;

xhr.open("GET","check.php?v1="+v1+"&v2="+v2+"&v3="+v3);
xhr.onreadystatechange=function(){
                        	if(xhr.readyState==4){
	                           if(xhr.status==200){
	                               if(xhr.responseText=="true"){
                                                  //no se si es esto lo que necesitas
                                                  window.print();   
                                                  return true;                                           
                                      }else{
                                              alert("Datos Incorrectos");             
                                              return false; 
                                        }
                                   }
                              }
                         }
xhr.send(null);
}
</script>