1.0.22 • Published 12 years ago

xhrequest v1.0.22

Weekly downloads
112
License
-
Repository
-
Last release
12 years ago

XHREQUEST

A jQuery-like mechanism for making remote requests over http and https.

Installation

npm install xhrequest

Usage

Get a reference to the module:

var XHR = require('xhrequest');

Then send the request with either of the two syntaxes jQuery accepts:

// URL as a string and a configuration object
XHR(url, configurationOptions);

// or a single configuration object that includes the URL
XHR(configurationOptionsWithUrl);

That's it, additional configuration and all callback functions are included in the configuration object:

Config.success

function(responseData, response, status) called for any request with status code 200

Config.error

function(responseData, response, status) called for any request that has a status code other than 200 (including all 2** responses).

Config.complete

function() called after either the success or error handlers have been called, takes no arguments.

Config.method

The HTTP verb for the request - for example GET, POST, PUT, DELETE or HEAD.

Config.data

Any data to send with the request. By default the data is assumed to be a form post so the content-type header will be set to application/www-urlencoded, to override this supply the correct header (see below).

Config.headers

An object of headers to send with the request.

Config.cookies

An object of cookie names / values to send with the request.

1.0.22

12 years ago

1.0.21

12 years ago

1.0.20

12 years ago

1.0.17

12 years ago

1.0.16

12 years ago

1.0.15

12 years ago

1.0.13

12 years ago

1.0.12

12 years ago

1.0.11

12 years ago

1.0.10

12 years ago

1.0.9

12 years ago

1.0.8

12 years ago

1.0.7

12 years ago

1.0.6

12 years ago

1.0.5

13 years ago

1.0.3

13 years ago

1.0.2

14 years ago

1.0.1

14 years ago

1.0.0

14 years ago