1.0.1 • Published 7 years ago

simple-ajax-request v1.0.1

Weekly downloads
3
License
ISC
Repository
github
Last release
7 years ago

simple-ajax-request

Description: a library that simplifies making ajax requests from the frontend without having to use jquery

Usage:

npm install simple-ajax-request

Example:

/*
  @param: <Object> params {
    method: <String> (required),
    url: <String> (required),
    sendCookies: <Boolean> (optional),
    auth: <String> || <Object> (optional),
      {
        username: <String>,
        password: <String>
      }
    headers: <Object> (optional)
  }
  
  @param: <Function> callback(<Error> err, <Object> response):
    <Object> response {
      status: <Number>,
      headers: <Object>,
      body: <String>,
      xhr: <XMLHttpRequest>
    }
*/

ajaxRequest({
  method: "GET",
  url: "a url",
  sendCookies: true
}, function(error, response){
  console.log(arguments)
});