[thelist] Prototype/AJAX Neubie question

Phillip M. Vector phillipmvector at comcast.net
Sun Jul 15 21:45:44 CDT 2007


Putting in xmlHttp.onreadystatechange=this.stateChanged; worked. Thanks. :)

Anthony Baratta wrote:
> Another way do to what you want is to us Javascript "pseudo-objects".
> 
> =-=-=-==-=-=-==-=-=-==-=-=-==-=-=-=
> 
> function ShowMessages()
> {
>      this.xmlHttp;
> 
>      function Run()
>      {
>          this.xmlHttp=GetXmlHttpObject();
>          this.url="CheckMessages.cfm";
>          this.url=url+"&room="+document.getElementById("Room").value;
>          this.xmlHttp.onreadystatechange=stateChanged;
>          this.xmlHttp.open("GET",url,true);
>          this.xmlHttp.send(null);
>      }
> 
>      function stateChanged()
>      {
>          if (xmlHttp.readyState==4)
>          {
>  
> document.getElementById("Messages").innerHTML=xmlHttp.responseText;
>          }
>      }
> }
> var objShowMsgs = new ShowMessages();
> 
> 
> function checkusers()
> {
>      this.xmlHttp;
> 
>      function Run()
>      {
>          this.xmlHttp=GetXmlHttpObject()
>          this.url="CheckUsers.cfm";
>          this.xmlHttp.onreadystatechange=this.UsersChanged;
>          this.xmlHttp.open("GET",url,true);
>          this.xmlHttp.send(null);
>      }
> 
>      function UsersChanged()
>      {
>          if (xmlHttp.readyState==4)
>          {
>  
> document.getElementById("Users").innerHTML=xmlHttp.responseText;
>          }
>      }
> }
> var objUsersChanged = new UsersChanged();
> 
> =-=-=-==-=-=-==-=-=-==-=-=-==-=-=-=
> 
> Then just call objShowMsgs.Run(); or objUsersChanged.Run();
> 



More information about the thelist mailing list