Client Class HttpClient

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.

function HttpSample()
	var Http = new HttpClient();     
	var Result = Http.send("http://localhost/",null,
	                       function(result) { 
	                        alert("It worked: " + result);  // shows HTML result
	                        alert("Error: " + error.message);

Note that calls are asynchronous so results are fired into the result functions out of band. To make multiple simultaneous callbacks create multiple instances of this class.


This class has no dependencies on server side features.

Class Members



Appends an HTTP header to the current request.



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.



The accept type(s) that are accepted for the response.


Optional handler called when the call completes. Receives a string parameter that is the result of the HTTP request.


The content type for any POST data that might be sent.


Optional handler called when an error occurs. Receives an instance of CallbackException error object.


Determines whether the result from the callback is automatically evaluated using eval(). Useful for JSON responses.


Flag that determines whether the called service is an ASP.NET ASMX or WCF service that returns 'wrapped objects'. If set HttpClient will unwrap the object and return only the actual result value.


The HTTP verb used on this request.


The Url that is to be accessed on the server. This parameter can also be passed and is overridden by the first parameter to send but setting the property can provide a default and reusable value.


Determines the timeout for this request before it is considered failed.

See also:

Class HttpClient

© West Wind Technologies, 1996-2016 • Updated: 12/18/15
Comment or report problem with topic