simple-ajax-request

1.0.1 • Public • Published

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)
});
 

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i simple-ajax-request

      Weekly Downloads

      3

      Version

      1.0.1

      License

      ISC

      Last publish

      Collaborators

      • mistermoe