Foros del Web » Programando para Internet » Javascript »

Problema con Js que carga en div un php...

Estas en el tema de Problema con Js que carga en div un php... en el foro de Javascript en Foros del Web. Hola que tal? bueno, en realidad mi problema tiene varias partes. 1. Por un lado tengo un div que carga un php mediante js, que ...
  #1 (permalink)  
Antiguo 01/06/2010, 09:16
 
Fecha de Ingreso: junio-2010
Mensajes: 11
Antigüedad: 13 años, 11 meses
Puntos: 0
Problema con Js que carga en div un php...

Hola que tal? bueno, en realidad mi problema tiene varias partes.
1. Por un lado tengo un div que carga un php mediante js, que quiero que carge otro php en otro div interior, o sea anidados. Mi problema se presenta pq adentro del div padre muestro por html una tabla la cual tiene un campo a llenar por goles (mundial sudafrica) y tengo que pasar por post un array con los datos insertados. Para ello uso un js que no se si esta bien pues no lo escribi yo..

Código:
<script type="text/javascript">
//<script>
function objetus(file) {
    xmlhttp=false;
    this.AjaxFailedAlert = "Su navegador no soporta las funciónalidades de este sitio y podria experimentarlo de forma diferente a la que fue pensada.Por favor habilite javascript en su navegador para verlo normalmente.\n";
    this.requestFile = file;
    this.encodeURIString = true;
    this.execute = false;
    if (window.XMLHttpRequest) { 
        this.xmlhttp = new XMLHttpRequest();
        if (this.xmlhttp.overrideMimeType) {
            this.xmlhttp.overrideMimeType('text/xml');
        }
    } 
    else if (window.ActiveXObject) { // IE
        try {
            this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        }catch (e) {
            try {
                this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
                this.xmlhttp = null;
            }
        }
        if (!this.xmlhttp && typeof XMLHttpRequest!='undefined') {
            this.xmlhttp = new XMLHttpRequest();
            if (!this.xmlhttp){
                this.failed = true; 
            }
        } 
    }
    return this.xmlhttp ;
}
function recibeid(_pagina,valorget,valorpost,capa){ 
    ajax=objetus(_pagina);
    if(valorpost!=""){
        ajax.open("POST", _pagina+"?"+valorget+"&tiempo="+new Date().getTime(),true);
    } else {
        ajax.open("GET", _pagina+"?"+valorget+"&tiempo="+new Date().getTime(),true);
    }
    ajax.onreadystatechange=function() {
        if (ajax.readyState==1){
            document.getElementById(capa).innerHTML = 
				"<img src='loadingcircle.gif' align='center'> Aguarde por favor...";
        }
        if (ajax.readyState==4) {
            if(ajax.status==200)
            {document.getElementById(capa).innerHTML = ajax.responseText;}
            else if(ajax.status==404)
            {
                capa.innerHTML = "La direccion no existe";
            }
            else
            {
                capa.innerHTML = "Error: ".ajax.status;
            }
        }
    }
    if(valorpost!=""){
        ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        ajax.send(valorpost);
    } else {
        ajax.send(null);
    }
} 
</script>
Ok, el fragmento de codigo de mi php es el siguiente:


Código PHP:
<form  method="post"  onsubmit="return false" >

// Consulta Mysql para sacar datos... y luego el while para llenar tabla html.

while ($dato != null){
list(
$year$month$day) = explode("-"$dato[3]);
$date date('d M, Y'mktime(000$month$day$year));
//Lleno tabla de partidos
echo "<tr>";
$id_partido[$i]=$dato[0];
echo 
"<td><input name=\"datos[]\" type=\"hidden\" value=\"".$dato[0]."\"></td>";
echo 
"<td>"; echo "<img src=\"".$dato[9]."\"/>";echo "</td>";
echo 
"<td>";echo utf8_encode($dato[8]);echo "</td>";
echo 
"<td><input type=\"text\" name=\"datos[]\" size=\"1\" maxlength=\"2\" value=\"".$dato[14]."\" ".$activo."></td>";
echo 
"<td>"; echo "<img src=\"".$dato[12]."\"/>";echo "</td>";
echo 
"<td>";echo utf8_encode($dato[11]);echo "</td>";
echo 
"<td><input type=\"datos[]'\" name=\"datos[]\" size=\"1\" maxlength=\"2\" value=\"".$dato[15]."\" ".$activo."></td>";
echo 
"<td>";echo $dato[13];echo "</td>";
echo 
"<td>".$date."</td>";
echo 
"<td>";echo $dato[4];echo "</td>";
echo 
"</tr>";
$dato mysql_fetch_row($result);
$i++;

}

echo 
"</table>";

<
label>
<
input type="submit" name="submit" value="Guardar" onClick="recibeid('./guardarDatos.php','',datos='datos[]','estado')">
</
label>
<
input name="Restablecer" type="reset" value="Limpiar">
</
form
bueno, cuando recibo por post en guardarDatos.php no recibo nada.. alguien puede ayudarme? Se los agradeceria mucho.


Saludos

p.d: lo puse tb en la seccion php porque no se si el problema es de php o del script, sepan disculpar las molestias del caso.

Última edición por garzota; 01/06/2010 a las 09:54
  #2 (permalink)  
Antiguo 01/06/2010, 10:34
 
Fecha de Ingreso: junio-2010
Mensajes: 11
Antigüedad: 13 años, 11 meses
Puntos: 0
Respuesta: Problema con Js que carga en div un php...

ya esta.. solucione

Etiquetas: carga, js, php
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 22:28.