Ver Mensaje Individual
  #10 (permalink)  
Antiguo 08/05/2007, 06:54
Asyolath
 
Fecha de Ingreso: abril-2006
Mensajes: 80
Antigüedad: 18 años, 1 mes
Puntos: 2
Re: AJAX mediante POST, no hace nada

Hola, que tal. A ver, prueba a reescribir tu función así:

Código:
function fajax()    
{
    var titulo,texto,accion;
    titulo = document.getElementById('titulo').value;
    texto = document.getElementById('texto').value;
    accion = document.getElementById('accion').value;

    ajax=ajaxFunction();
    ajax.open("POST", "informacion_ajax.php",true);
    ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

    ajax.onreadystatechange=function() 
    {
	if (ajax.readyState==4) 
	{
	    if (ajax.status==200)
	    {
		if (ajax.responseText=='Ondo')
		{
		    location.href="informacion.php";
		}
		else if (ajax.responseText=='Txarto')
		{
		    alert("Ha ocurrido algun error, intentelo de nuevo");
		}
                else alert("Ha ocurrido un error: ajax.responseText= "+ajax.responseText);
	    }
	    else alert("Ha ocurrido un error: ajax.status= "+ajax.status);
	}
        else alert("Estado actual= "+ajax.readyState+". Pulsa en Aceptar para continuar.");
    }

    ajax.send("titulo="+titulo+"&texto="+texto+"&accion="+accion);
}
Y si sigue sin funcionar me dices que alerts te han salido.

Última edición por Asyolath; 08/05/2007 a las 06:59