README.md

It's AJAX

All over again. Includes support for xmlHttpRequest, JSONP, CORS, and CommonJS Promises A.

It is also isomorphic allowing you to require('reqwest') in Node.js through the peer dependency xhr2, albeit the original intent of this library is for the browser. For a more thorough solution for Node.js, see mikeal/request.

$('#myform input[name=myradios]').serialize({type:'map'})['myradios'] // get the selected value$('input[type=text],#specialthing').serialize() // turn any arbitrary set of form elements into a query string

ajaxSetup

Use the request.ajaxSetup to predefine a data filter on all requests. See the example below that demonstrates JSON hijacking prevention:

spm

jQuery and Zepto Compatibility

There are some differences between the Reqwest way and the
jQuery/Zepto way.

method

jQuery/Zepto use type to specify the request method while Reqwest uses
method and reserves type for the response data type.

dataType

When using jQuery/Zepto you use the dataType option to specify the type
of data to expect from the server, Reqwest uses type. jQuery also can
also take a space-separated list of data types to specify the request,
response and response-conversion types but Reqwest uses the type
parameter to infer the response type and leaves conversion up to you.

JSONP

Reqwest also takes optional jsonpCallback and jsonpCallbackName
options to specify the callback query-string key and the callback function
name respectively while jQuery uses jsonp and jsonpCallback for
these same options.

But fear not! If you must work the jQuery/Zepto way then Reqwest has
a wrapper that will remap these options for you: