Foros del Web » Programando para Internet » Javascript » Frameworks JS »

No funcionar el codigo

Estas en el tema de No funcionar el codigo en el foro de Frameworks JS en Foros del Web. Quien podria decirme, que es loq eu le falta a este codigo? no me funciona, se supne qeu despues de seleccionar un combobox y ser ...
  #1 (permalink)  
Antiguo 08/07/2011, 07:53
Avatar de fernandaYO  
Fecha de Ingreso: mayo-2011
Ubicación: Medellin
Mensajes: 166
Antigüedad: 12 años, 11 meses
Puntos: 4
No funcionar el codigo

Quien podria decirme, que es loq eu le falta a este codigo?
no me funciona, se supne qeu despues de seleccionar un combobox y ser enviada la iformacion, se deberia activar el otro..
pero.. no se activa.. cual sera el error? porfa Helpmeeeeeeeeeeeeee!!!

Código PHP:
<?php include "conexion.php";
?>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Muestras Bonco S.A</title>
</head>
<script>
//hacer que funcione con diferentes navegadores
function requerir(){
try{
req=new XMLHttpRequest();
}catch(err1){
try{
req=new ActiveXObject("Microsoft.XMLHTTP");
}catch(err2){
try{
req=new ActiveXObject("Msxml2.XMLHTTP");
}catch(err3){
req= false;
}
}
}
return req;
}


var peticion=requerir();

function llamarAjaxGETpro(){
var aleatorio=parseInt(Math.random()*999999999);
valor=document.getElementById("Empresa").value;
var url="fecha.php?valor="+valor+"&r="+aleatorio;
peticion.open("GET",url,true);
peticion.onreadystatechange =respuestaAjaxpro;
peticion.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
peticion.send(null);
}


function respuestaAjaxpro(){

if(peticion.readyState==4){
if(peticion.status==200){
//alert(peticion.responseText);
document.getElementById("pro").innerHTML=peticion. responseText;
}else{
alert("ha ocurrido un error"+peticion.statusText);
}
}
}

</script>

<body>
<form action="" method="post" enctype="application/x-www-form-urlencoded" name="form1" id="form1">
<div id="dep" style="width:150px; float:left">
<select name="fecha" id="fecha" onChange="llamarAjaxGETpro()">
<option>---Seleccione---</option>


<?php
$re
=mysql_query("select distinct Empresa from prueba2");
while(
$f=mysql_fetch_array($re)){

echo
'<option value="'.$f['Empresa'].'">'.$f['Empresa'].'</option>';
}
?>
</select>
</div>
<div id="pro" style="width:150px; float:left">
<select disabled="disabled">
<option>---Seleccione---</option>
</select>
</div>
</form>

</body>
</html>
y el
Fecha.php
Código PHP:

<?php

include "conexion.php";
$valor=$_GET['valor'];
$re=mysql_query("select distinct Fecha_en from prueba2 where Empresa='%$valor'% ");
echo
'<select id="fecha" onchange=llamarAjaxGETpro()>';
echo
'<option >---Seleccione---</option>';
while(
$f=mysql_fetch_array($re)){
echo
'<option value="'.$f['Fecha_en'].'">'.$f['Fecha_en'].'</option>';
}

echo
'</select>';
?>
Gracias
__________________
Umm, infraccion :(//

Etiquetas: ajax, php, post, select
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:06.