Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/10/2008, 09:47
Avatar de salbatore
salbatore
 
Fecha de Ingreso: abril-2007
Ubicación: Springfield
Mensajes: 1.567
Antigüedad: 17 años, 7 meses
Puntos: 19
Envio por post

Hola, foreros:

Me estoy volviendo adicto al ajax, jeje. Mirar tengo una funcion para enviar elementos mediante 'post' , el problema es que no funciona en firefox, he probado a usar firebug y viendo las acciones de javascript me muestra que envia dos post uno detras de otro, algo muy raro...

¿Os suele ocurrir?, este es el codigo que funciona perfectamente en todos los demas navegadores, solo falla en Firefox:

Código PHP:
function addLoadEvent(func
            {
                var 
oldonload window.onload;
                if (
typeof window.onload != 'function'
                    {
                        
window.onload func;
                    }     
                else 
                    {
                        
window.onload = function() 
                            {
                                if (
oldonload
                                    {
                                        
oldonload();
                                    }
                                
func();
                             }
                     }
            }
            
// load:
                
var request false;

                if (
window.XMLHttpRequest
                    {
                        
request = new XMLHttpRequest();
                    }

                function 
form_nick_ajax_validation() 
                    {
                        
                        if (
window.ActiveXObject
                            {
                                try 
                                    {
                                        
request = new ActiveXObject("Msxml2.XMLHTTP");
                                    } 
                                catch(
e
                                    {
                                        try 
                                            {
                                                
request = new ActiveXObject("Microsoft.XMLHTTP");
                                            } 
                                        catch(
e
                                            {
                                                
request false;
                                            }
                                     }
                            }
                        if (
request
                            {
                                
                                
request.onreadystatechange form_nick_ajax_receibe;
                                
request.open("POST""xxxx.php");
                                
request.setRequestHeader('Content-Type''application/x-www-form-urlencoded;');
                                
request.send
                                    
("nick="+encodeURIComponent(form_nick_id.value));
                            }
                    }
            function 
form_nick_ajax_receibe() 
                {
                    if (
request.readyState == 4
                        {
                            if (
request.status == 200
                                {
                                    
form_nick_request request.responseText;
                                    
form_nick_alert_id.innerHTML form_nick_request;
                                    
form_nick_examination = /o/;
                                    if(
form_nick_examination.test(form_nick_request)){form_nick_id.style.background='#FF0000';}
                                    else{
form_nick_id.style.background='#99CC00';}
                                }
                        } 
                    else 
                        {
                            
form_nick_alert_id.innerHTML "← Validando";
                        }
                }