JSPM

  • Created
  • Published
  • Downloads 19675
  • Score
    100M100P100Q147431F

A wrapper for asynchronous http requests

Package Exports

  • reqwest

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (reqwest) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

It's AJAX

All over again.

The happs

$ git clone git://github.com/ded/reqwest.git reqwest
$ cd !$
$ npm install --dev
$ make

API

reqwest('path/to/html', function (resp) {
  qwery('#content').html(resp)
})
reqwest({
    url: 'path/to/json'
  , type: 'json'
  , method: 'post'
  , error: function (err) { }
  , success: function (resp) {
      qwery('#content').html(resp.content)
    }
})
reqwest({
    url: 'path/to/data.jsonp?callback=?'
  , type: 'jsonp',
  , success: function (resp) {
      qwery('#content').html(resp.content)
    }
})
reqwest({
    url: 'path/to/data.jsonp?foo=bar'
  , type: 'jsonp'
  , jsonpCallback: 'foo'
  , success: function (resp) {
      qwery('#content').html(resp.content)
    }
})

The Tests

$ npm test

Browser support

  • IE6+
  • Chrome 1+
  • Safari 3+
  • Firefox 1+
  • Opera

Ender Support

Reqwest can be used as an Ender module. Add it to your existing build as such:

$ ender add reqwest

Use it as such:

$.ajax({ ... })
$(form).serialize()
$(form).serializeArray()

Happy Ajaxing!