Skip to content
async requests simplified
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
package.json
rq.js
rq.min.js

README.md

rq - async requests simplified

rq is a small library to simplify asynchronous requests without having to rely on heavy libraries like jquery. It uses the fetch API which is supported by almost all modern browsers and therefore is promise-based.

Documentation

rq.get("YOUR_URL").then(function(res) {
  // handle response
}).catch(function(err) {
  // handle error
});

// pass data as second parameter
rq.post("YOUR_URL", someData).then(handleResponse).catch(handleError);
rq.put("YOUR_URL", someData).then(handleResponse).catch(handleError);
rq.delete("YOUR_URL").then(handleResponse).catch(handleError);

// you can also pass in fetch options
var options = {
  method: "POST",
  headers: new Headers({
    "Content-Type": "application/json"
  }),
  body: JSON.stringify(data) 
}
rq.fetch("YOUR_URL", options).then(handleResponse).catch(handleError);

For a full list of options refer to the fetch API.

You can’t perform that action at this time.