CHAPTER 2 THE (Web design tools) NUTS AND BOLTS OF

CHAPTER 2 THE NUTS AND BOLTS OF AJAX Figure 2-7. Debugger illustrating that a function does not reference a class instance The debugger shown in Figure 2-7 is distributed with Mozilla, and in the middle window on the left side is a reference to the this variable. The watch window illustrates that this does not reference an instance and is a plain, simple ScriptFunction. This means that even though the original function was associated with an instance of Asynchronous, when used as a callback the reference disappears. A solution would be to cross-reference a request with an Asynchronous instance that is stored in an array that is accessed to identify the request. Such a solution is complicated and relies on some global array. The solution is not a complex cross-referencing algorithm, but the use of a unique implementation detail of JavaScript. Look back at the implementation of Asynchronous_call, illustrated briefly as follows: function Asynchronous_call(url) { var instance = this; this._xmlhttp.open(’GET’, url, true); this._xmlhttp.onreadystatechange = function() { switch(instance._xmlhttp.readyState) {
Note: In case you are looking for affordable webhost to host and run your servlet application check Vision mysql5 web hosting services

Leave a Reply