Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/12/2013, 21:30
Avatar de Killerx_8937
Killerx_8937
 
Fecha de Ingreso: noviembre-2006
Mensajes: 99
Antigüedad: 17 años, 5 meses
Puntos: 0
De acuerdo Problemas con readyState ==1

hola chicos ya se me parte el craneo con esto

tengo esta pagina que llama un metodo de la pagina ajaxdocumntos.php

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>Documento sin título</title>
  5.  
  6. <script type="text/javascript">
  7. function nuevoAjax()
  8. {
  9.     var xmlhttp=false;
  10.     try
  11.     {
  12.         xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
  13.     }
  14.     catch(e)
  15.     {
  16.         try
  17.         {
  18.             xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  19.         }
  20.         catch(E)
  21.         {
  22.             if (!xmlhttp && typeof XMLHttpRequest!='undefined') xmlhttp=new XMLHttpRequest();
  23.         }
  24.     }
  25.     return xmlhttp;
  26. }
  27. function Notifica(codigo,run)
  28. {
  29.     ajax=nuevoAjax();
  30.     ajax.open("POST", "ajaxdocumentos.php?hddCodigo="+codigo+"&hddRun="+run+"&Accion=notificaCambioVer",true);
  31.     ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  32.     ajax.onreadystatechange = function()
  33.     {
  34.         if (ajax.readyState==0||ajax.readyState==1||ajax.readyState==2||ajax.readyState==3)
  35.         {
  36.             document.getElementById(run).innerHTML = "<img src='img/loading.gif' align='center' /> Aguarde por favor...";
  37.         }
  38.         if(ajax.readyState==4)
  39.         {
  40.             document.getElementById(run).innerHTML = ajax.responseText;
  41.         }
  42.     }
  43.     ajax.send(null);
  44. }
  45. Notifica('ASTM-D2166','13.899.942-4');
  46. </head>
  47. <div id="13.899.942-4"></div>
  48. </form>
  49. </body>
  50. </html>

ajaxdocumentos.php

Código PHP:
Ver original
  1. <?php
  2. require_once ("../includes/core.php");
  3. require_once("../includes/class/class.php");
  4. if($_SESSION['SISADMIN_LOGIN'] != true)
  5. {
  6. header("location:".BASEDIR."index.php");
  7. }
  8. $pagina = new Pagina();
  9. $strPermisos = $pagina->acceso($_SESSION['SISADMIN_RUN'],"PG0007","V");
  10. if($_REQUEST["Accion"]=="cargaCodificacion")
  11. {
  12.     $doc = new Documento;
  13.     $responce = $doc->getTipoDocumentoCod($_REQUEST["opcion"]);
  14.  
  15.     echo "<input type='text' name='DocCod' id='DocCod' onKeyUp='return Mayusculas(this)' onblur='validaExistencia()' value='".$responce[0]["Tipos_Codificacion"]."'><div class='MysqlError' id='divExistencia'></div><div class='small'>".$responce[0]["Tipos_DescCodificacion"]."</div>";
  16. }
  17. elseif($_REQUEST["Accion"]=="cargaValidacion")
  18. {
  19.     $doc = new Documento;
  20.     $responce = $doc->getTipoDocumentoCod($_REQUEST["opcion"]);
  21.  
  22.     echo $responce[0]["Tipos_Codificacion"];
  23. }
  24. elseif($_REQUEST["Accion"]=="validaExistencia")
  25. {
  26.     //print_r($_REQUEST);
  27.     $doc = new Documento;
  28.     if($_REQUEST["codigo"]=="")
  29.     {
  30.         $_REQUEST["codigo"]="x";
  31.     }
  32.     $responce = $doc->buscarDocumentoCod($_REQUEST["codigo"]);
  33.     if(count($responce)==0)
  34.     {
  35.        
  36.     }
  37.     else
  38.     {
  39.         echo "El Codigo ya esta ingresado";
  40.     }
  41. }
  42. //p
  43. elseif($_REQUEST["Accion"]=="cargaVersionDoc")
  44. {
  45.     $doc = new Documento;
  46.     $responce = $doc->buscarDocumentoCod($_REQUEST["opcion"]);
  47.    
  48.     echo $responce[0]["Doc_VerVig"];
  49. }
  50. elseif($_REQUEST["Accion"]=="notificaCambioVer")
  51. {
  52.     $not = new Notificaciones;
  53.     $not->notificarCambioVerDoc($_REQUEST["hddCodigo"],$_REQUEST["hddRun"]);
  54.    
  55. }
  56. ?>

el metodo notificarCambioVerDoc envia un correo electronico con phpmailer, el problema es que readyState==1 nunca me muestra el mensaje aguarda por faor (loading), solo me muestra el responceText con el resultado de la consulta que podra ser help!!