Client Class wwHttp

The wwHttp class provides a thin wrapper around the browser XmlHttp object to allow making callbacks. The control manages hooking up a callback handler and managing errors by calling the callback handler or error handler when the calls complete.

Focus of this control is to make the callback process very easy but still provide robust error management.

To make multiple simultaneous callbacks create multiple instances of this class.

function wwHttpSample() { var Http = new wwHttp(); var Result = Http.send("http://localhost/",null,TestCallback,OnError); } function TestCallback(Result) { alert("SUCCESS" + Result); } function OnError(Result) { alert("*** On Error Called:\r\n\r\n" + Result.message); }


Remarks

This class has no dependencies on server side features.

Class Members

MemberDescription
appendHeader Appends an HTTP header to the current request.
o.wwHttp.addHeader(HeaderName,Value)
encodeFormVars Creates a URL encoded string of all the form variables for a given form on the page.
o.encodeFormVars(FormVars,NoViewState)
encodeValue Urlencodes a single value.
o.encodeValue(value)
returnError This method creates a CallbackException object and then calls teh errorCallback function for this wwHttp instance if one is defined.
o.returnError(Message)
send Used to make an asynchronous HTTP call to the server and return the result into a callback function. This method provides error handling and any errors that occur are fired into the OnError handler.
o.send(Url,PostData,Callback,ErrorCallback)
contentType The content type for any POST data that might be sent.
evalResult Determines whether the result from the callback is automatically evaluated using eval(). Useful for JSON responses.

Requirements

See also:

Class wwHttp

  Last Updated: 10/9/2007 | © West Wind Technologies, 2008