Home

Awesome

<p align="center"> <img src="media/logo.png" width="200"> </p>

JHRW - JavaScript HTTP Request Wrapper

A wrapper for so-called "AJAX" Requests

Goals

I've made JHRW to:

Documentation

Object JHRW(String base, String urlPath [, Boolean lazyExecution = false [, Boolean bypassCache = false]]);

Parameters

Throws

Returns

An Object containing:

Properties

Static Properties

Methods

configure
void configure(Object configureObject);

Overwrites one or more configuration options (see the config object above)

init
void init();

Initializes the request: Sets the expected response MIME Type; Sets the handlers as listeners; Opens the request; Sets the request's headers.

send
void send();

Sends the request, including data, if available.

end
void end();

Ends the request. Useful if you wish for JHRW to stop retrying on success.

Basic Usage

try {
	var obj = new JHRW('http://localhost', /foo.php', true);
} catch (Error e) {
	// Do something
}

or

try {
	var req = new JHRW('http://localhost', 'foo.php');

	try {
        req.init();
	} catch (ReferenceError e) {
        // Do something
    }

    req.send();
} catch (Error e) {
    // Do something
}

For a more advanced usage example see the testing page.

Credits