Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    [ajax] this._XmlHttp has no properties

    Errore: this._XmlHttp has no properties
    File sorgente: ajax.js
    Riga: 91

    qual'è l'errore?

    vi posto il codice interessato....
    codice:
    function ARRT (mode)
    {	this._XmlHttp=false;	
    	this._Mode=(mode=='xml')?'responseXML':'responseText';
    	this.Error=this._SetObj();		
    	this.Result=false;
    }
    
    ARRT.prototype._SetObj	=	function()
    {	if(window.XMLHttpRequest) 
    	{	this._XmlHttp = new XMLHttpRequest(); 
    		return false;
    	}else	if(window.ActiveXObject)
    		{ try{	this._XmlHttp = new ActiveXObject("MSXML2.XMLHTTP");
    			return false;
    		     }
    		  catch(e)
    			{ this._XmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); 
    			 return false;
    			}
    		}
    	return true;
    }
    
    
    ARRT.prototype.Request	=	function (url, dati, async)
    {
    if (!this.Error)
    { if (dati=='')
      {// Metodo GET
        this._XmlHttp.open('GET', url, async);
        }else
      {// Metodo POST
        this._XmlHttp.open("POST", url, async);
        this._XmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
        this._XmlHttp.setRequestHeader("Content-length",dati.length);
        this._XmlHttp.setRequestHeader("Connection","close");
      }	
    
      this._XmlHttp.onreadystatechange	=	function()
      {if ( this._XmlHttp.readyState == 4 )
    	{if ( this._XmlHttp.status == 200 )
    	  {this.Result = this._XmlHttp+'.'+this._Mode;
    	  }
    	  else
    	  {this.Error = this._XmlHttp.status;
    	  }
    	}
      }
      this._XmlHttp.send(null)
    }
    }
    il codice sopra è in un file esterno che includo
    e per chiamarla....
    codice:
    <script language="Javascript">
    function ajax(s)
    {	r= new ARRT('text');
    	if (!r.Errore)	r.Request('t.php?ciao=fra','',true);
    }
    </script>
    There are 10 types of people in the world: Those who understand binary, and those who don't.

  2. #2
    risolto, era un problema di scope
    There are 10 types of people in the world: Those who understand binary, and those who don't.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.