Create an Account
username: password:
 
  MemeStreams Logo

Encapsulating XmlHttpRequest Calls within JavaScript classes

search

Acidus
Picture of Acidus
My Blog
My Profile
My Audience
My Sources
Send Me a Message

sponsored links

Acidus's topics
Arts
Business
Games
Health and Wellness
Home and Garden
Miscellaneous
Current Events
Recreation
Local Information
Science
Society
Sports
Technology

support us

Get MemeStreams Stuff!


 
Encapsulating XmlHttpRequest Calls within JavaScript classes
Topic: Technology 1:42 pm EST, Dec 11, 2006

Or, solving the scope issue of callback functions without resorting to global variables!

//set the var so we can scope the callback var _this = this;
//callback will be an anonymous function that calls back into our class
//this allows the call back in which we handle the response (_onData())
// to have the correct scope.
this._request.onreadystatechange = function(){_this._onData()};

Encapsulating XmlHttpRequest Calls within JavaScript classes



 
 
Powered By Industrial Memetics
RSS2.0