Since the first publication I have implemented some changes and additions in the AJAX engine and the framework for WebServices.
prepare(option) / finish(data, option), onExeption(ex, option)
The ajax.Start Method now has a second parameter. This value is stored into the queue of the AJAX engine together with the fist parameter specifying the action.
When the prepare and finish methods are executed as well on handling en exception, this value is passed as an additional parameter. By using this value it is possible to store a context of an action. That may be for example a HTML object that started the action. Because all methods have access to it, it is now possible to use the same action definition for multiple fields, forms or other situations. Without this parameter it was necessary to implement the direct access to the HTML objects inside the prepare and finish methods.
Calling this method will close the actual connection to the saver by calling the abort method of the xmlhttp object before the result is returned from the server.
This is only possible on asynchronous calls.
This method makes it easy to watch the communication of the return value of a server call. But the situation is similar to the Heisenberg uncertainty principle: If you watch the package you cannot see the effect anymore because the data from the server is shown to the user but is not passed to the finish method. Also the timing situation is ruined because an alert box is used.
This option can be activated by assigning the alertResult method to the otherwise internally used corefunc property.
proxies.service.method.corefunc = proxies.alertResult;
Even if it breaks, it was necessary from time to time to see the result of a call so this option remains in the client-side WebService framework.
It is not well known that the Microsoft Internet Explorer (IE) allows to copy the content of an alert box into the clipboard by using Ctrl+C.
This method cancels the execution of the currently running action. If a timeout value is specified in the action options this method is called automatically.
This method cancels the execution of the currently running and all the pending actions.