Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/08/2008, 13:10
guzmange
 
Fecha de Ingreso: mayo-2008
Mensajes: 43
Antigüedad: 16 años
Puntos: 0
Buenas gente! necesito ayuda , hace dias que estoy como loco buscando info pero en ningun lado encontre explicacion satisfactible..
Primero resumo y luego pongo explicito con codigo..
Tengo una pagina 1 con un formulario vacio y un select , al poner seleccionar una funcion java corre y ejecuta el famoso ajax que manda a una segunda pagina un petitorio y esta devuelve info que llena en los campos del formulario de esta forma llenandolo con info de la bd... bueno todo esto funciona perfecto en firefox.. perooooooo en internet explorer no se que pasa que me tira error de OBJECT REQUIRED, y no despliega nada. la verdad no se que mas buscar , me fije en el header en el objeto ajax que este bien lo para IE . si alguien tiene alguna solucion o algo que me estoy comiendo avisenmen quedare muy agradecido...

Despliego el codigo...

Pagina ej1.php
Código:
<?php
session_start();?>
<html>
<head>
<script language="javascript" type="text/javascript">
var xmlhttp;
function nuevoAjax()
{ 
     
    try 
    { 
        xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
    }
    catch(e)
    { 
        try
        { 
            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
        } 
        catch(E) { xmlhttp=null; }
    }
    if (!xmlhttp && typeof XMLHttpRequest!='undefined')
	 { xmlhttp=new XMLHttpRequest(); } 
    return xmlhttp; 
}
function traerDatos()
{
    
	var cod=document.getElementById("cod").value;
	//alert (cod);
    var campo1=document.getElementById("c1");
    var campo2=document.getElementById("c2");
	var campo3=document.getElementById("c3");
    var campo4=document.getElementById("c4");   
	var campo5=document.getElementById("c5"); 
    var campo6=document.getElementById("c6"); 
	var ajax=nuevoAjax();
    ajax.open("POST", "ej2.php", true);
    ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded charset=ISO-8859-1");
//	alert(cod);
	ajax.send("v="+cod);           
	ajax.onreadystatechange=function()
	//alert(ajax.send());
    {
        if (ajax.readyState==4)
        {
		
            var respuesta=ajax.responseXML;
			//var respuesta2=ajax.responseText;
			//alert(respuesta2);
			//alert (respuesta);
            campo1.value=respuesta.getElementsByTagName("nombre")[0].childNodes[0].data;
            campo2.value=respuesta.getElementsByTagName("apellido")[0].childNodes[0].data;
			campo3.value=respuesta.getElementsByTagName("ci")[0].childNodes[0].data;
            campo4.value=respuesta.getElementsByTagName("codigo")[0].childNodes[0].data;
            campo5.value=respuesta.getElementsByTagName("mails")[0].childNodes[0].data;
			campo6.value=respuesta.getElementsByTagName("tel")[0].childNodes[0].data;
        
		}
    }
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Ejemplo</title>
</head>
<body>
<?php
$fecha = date("d/m/Y");
 $hora = date("H:i:s");?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CALLS</title>
<style>
td{font-family:Verdana;font-size:10px;}
a{color:#2B60CD;}
.left{color:#2B60CD;text-decoration:underline;}
.txt{font-size:11px;padding-left:10px;padding-right:10px;}
.menu{color:#ffffff;font-family:Arial;font-weight:bold;font-size:8px;text-decoration:none;}
</style>
<body>
<table width="780" align="center" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="595"><img src="images/name.jpg" width="595" height="120" /></td>
    <td align="right"><div align="left">
      <p align="right"><?php echo $fecha ?></p>
      <p align="right"><?php echo $hora ?></p>
    </div>
      <p align="center"><strong>BIENVENIDO</strong></p>
      <p align="center"><?php echo  $_SESSION['usu']?></p></td>
  </tr>
  <form action="usuprocesa.php" method="post">
  <tr>
    <td><table width="593" border="1">
      <tr>
        <td colspan="3"><div align="center">
          <p><strong>MODIFICAR USUARIO USUARIO</strong></p>
          <p>
            <label>Usuario a Modificar                      
			<? mysql_connect("localhost", "root", "root") or die(mysql_error());
mysql_select_db("callcenter") or die(mysql_error());
$tabla = mysql_query ("SELECT * FROM usuarios " );
    echo"<select  id='cod' >";
    while ($registro = mysql_fetch_array($tabla)){
	    echo "<option value".$registro['usuario'].">".$registro['usuario']."</option>";
		}
		echo"</select>";
		echo"<input type='button' id='b1'  onclick='traerDatos()' value='Selecciona'>";
		?>   
            </label>
          </p>
        </div></td>
        </tr>
      <tr>
        <td width="192"><div align="center">NOMBRE
          <label>
          <input type="text" id="c1">
          <br>
           <br>
          </label>
        </div></td>
        <td width="182"><div align="center">APELLIDO
          
            <label>
              <input type="text" id="c2">
              <br>
              <br>
              </label>
      </div></td>
        <td width="197"><div align="center">
          <div align="center">CI</div>
        </div>
          <label>
          <div align="center">
            <input type="text" id="c3">
            <br>
            <br>
          </div>
          </label></td>
      </tr>
      <tr>
        <td height="57"><div align="center">
          <p>TEL</p>
          <label>
          <input type="text" id="c6"> <br><br>
          </label>
        </div></td>
        <td><div align="center">MAIL
            <label> <br />
            <input type="text" id="c5"><br><br>
          </label></div></td>
        <td><div align="center">
          <p>ASIGNACION DE DATOS A USUARIO</p>
          <p>
            <label>
            <select name="NIVEL2" id="NIVEL2">
              <option>15</option>
              <option>11</option>
              <option>115</option>
              <option>222</option>
            </select>
            </label>
          </p>
        </div>
          <p>&nbsp;</p></td>
      </tr>
      <tr>
        <td height="39">
          <p align="center">CONDICION</p>
          <p align="left">
            <label>
            <input name="opcion" type="radio"  value="1"/>
            ACTIVO            </label>
            <br />
            <label>
            <input name="opcion" type="radio" value="0" /> 
            NO ACTIVO</label>
</p>       
            <label>
            </label></td>
        <td><p align="center">NIVEL</p>
          <label>
            <input type="radio" name="NIVEL" value="100" id="NIVEL_0" />
            USUARIO</label>
          <br />
          <label>
            <input type="radio" name="NIVEL" value="900" id="NIVEL_1" />
            ADMINISTRADOR</label>
          <br />
        </p></td>
        <td><p align="center">CODIGO</p>
          <label>
          <div align="center">
            <input type="text" id="c4">
            <br>
             <br>
            </div>
          </label></td>
      </tr>
      <tr>
      <td height="39"><p>
          <label></label>
          <br />
        </p></td>
        <td><div align="center">
          <input type="submit" name="button" id="button" value="Enviar" />
        </div></td>
        <td>&nbsp;</td>
      </tr>
    </table>
    <p align="center">&nbsp;</p>
    <p>&nbsp;</p>
        <p>&nbsp;</p></td>
    <td>&nbsp;</td>
  </tr>
  </form>
  <tr>
    <td height="32" colspan="2" bgcolor="#336600" style="padding-left:15px;color:#ffffff;font-family:Tahoma;font-size:11px;"> | &copy; CALL.S | CALL CENTER MANAGER SOFTWARE | </td>
  </tr>
</table>
</body>
</html>
y aca la pagina 2 que devuelve un xml


Código:
<?php 
header("Content-Type:text/xml");
header("Cache-Control: no-cache, must-revalidate");
//header("Expires: Mon, 01 Jan 2009 01:00:00 GMT");$v=$_POST['v']; 
$v1=$_REQUEST['v'];
//$v1="BURROWS";
//echo $v;
$host = "localhost"; 
$user = "root"; 
$pass = "root"; 
$database = "callcenter";
 
$enlace = mysql_connect($host, $user, $pass) or die("Error MySQL."); 
mysql_select_db($database, $enlace) or die("Error base de datos.");
 
$query = "SELECT  *  FROM usuarios WHERE usuario='$v1'"; 
$resultado = mysql_query($query, $enlace) or die("Sin resultados.");
//echo count($resultado); 
$salida_xml = "<?xml version=\"1.0\"?>\n"; 
$salida_xml .= "<informacion>\n";
$salida_xml .= "<datos>\n";
 
for($x = 0 ; $x < mysql_num_rows($resultado) ; $x++){  
//echo "salio";
    $fila = mysql_fetch_array($resultado); 
    $salida_xml .= "\t<nombre>".$fila['usuario']."</nombre>\n"; 
	$salida_xml .= "\t<apellido>" . $fila['apellido'] . "</apellido>\n";
	$salida_xml .= "\t<ci>" . $fila['ci'] . "</ci>\n";
	$salida_xml .= "\t<codigo>" . $fila['codigo'] . "</codigo>\n";
	$salida_xml .= "\t<tel>" . $fila['tel'] . "</tel>\n";
	$salida_xml .= "\t<mails>" . $fila['mails'] . "</mails>\n";
  
 }
$salida_xml .= "</datos>";
 $salida_xml .= "</informacion>\n";
echo $salida_xml;
 
?>





GRACIAS DESDE YAAAA

Alguien que sepa porque una apliacion php-ajax-mysql de llenado automatico de campos de un formulario nutriendose de una base de datos mysql funcioan perfectamente en fire fox pero en Internet Explorer no lo hace y tira el erro OBJECT REQUIRED
estoy hace dias y no consigo saber el motivo!!
alguien porfavo!!!!
gracias desde ya!

Última edición por GatorV; 12/08/2008 a las 07:49