This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

jquery-methods

0.3.0 • Public • Published

jquery-methods

A little jquery request API focused on REST, express-style url building, and nodejs-style callbacks

$.GET('/my/:param', {param: 'test', query: 1}, function(err, result) {
  // anything else than a successful statusCode between 200 and 400 excluded
  if (err) return console.error(err);
  // use result here
});
 
$.POST(url, {optional query params}, {body params}, function(err, result) {
  // if server replies 201 with a Location header, result contains the value of
  // that header
});

$.DELETE, $.HEAD, $.COPY are processed as GET requests, $.PUT as a POST request.

All of these set "X-HTTP-Method-Override" HTTP header (expect weird corner cases when dealing with cross-domain requests and preflighted requests). https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS#Preflighted_requests

$.PUT or $.POST have these signatures: (url, query, body, cb) (url, body, cb) (url, body) (url, cb) (url)

All other methods without body have: (url, query, cb) (url, query) (url, cb) (url)

Package Sidebar

Install

npm i jquery-methods

Weekly Downloads

2

Version

0.3.0

License

MIT

Last publish

Collaborators

  • kapouer