Ver Mensaje Individual
  #19 (permalink)  
Antiguo 20/11/2010, 11:46
Avatar de tomymolina
tomymolina
 
Fecha de Ingreso: noviembre-2010
Mensajes: 50
Antigüedad: 13 años, 6 meses
Puntos: 1
Respuesta: Include dinamico con #

hola de nuevo creo que ya prove a enviarlo con ajax pero no se si lo estoy haciendo del manera correcta. Asi?

Código PHP:
<SCRIPT LANGUAGE=JavaScript>
function 
nuevoAjax(){
    var 
xmlhttp=false;
    try {
    
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (
e) {
    try {
    
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (
E) {
    
xmlhttp false;
    }
    }

    if (!
xmlhttp && typeof XMLHttpRequest!='undefined') {
    
xmlhttp = new XMLHttpRequest();
    }
    return 
xmlhttp;
}

function 
enviarFormulario(urlformiddivrespuesta){
        var 
Formulario document.getElementById(formid);
        var 
longitudFormulario Formulario.elements.length;
        var 
cadenaFormulario "";
        var 
sepCampos;
        
sepCampos "";
        for (var 
i=0<= Formulario.elements.length-1;i++) {
            
cadenaFormulario += sepCampos+Formulario.elements[i].name+'='+encodeURI(Formulario.elements[i].value);
            
sepCampos="&";
    }
    
peticion=nuevoAjax();
    
peticion.open("POST"urltrue);
    
peticion.setRequestHeader('Content-Type''application/x-www-form-urlencoded; charset=ISO-8859-1');
    
peticion.send(cadenaFormulario);
    
peticion.onreadystatechange = function() {
          if (
peticion.readyState == && (peticion.status == 200 || window.location.href.indexOf ("http") == - 1)){
                
document.getElementById(divrespuesta).innerHTML peticion.responseText;
          }
    }
}
</script>