Skip to content
A simple AJAX Library for making HTTP Requests
JavaScript
Branch: master
Clone or download
Latest commit 7587f07 Jun 28, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
demo update title Apr 6, 2019
dist update minified Apr 6, 2019
src
.babelrc setup babel ⚡️ Apr 6, 2019
.gitignore
LICENSE Initial commit Apr 5, 2019
README.md
_config.yml Update _config.yml Apr 6, 2019
package-lock.json setup babel ⚡️ Apr 6, 2019
package.json update package Apr 6, 2019

README.md

Getting Started

Download and include the JavaScript file | full version | minified | ES6 version |

<script src="simpleAjax.js"></script>
<script src="simpleAjax.min.js"></script>

Create a new simpleAjax

const http = new simpleAJAX;

Examples

  • GET Request
users = http.get('https://jsonplaceholder.typicode.com/users',
  (err, users) => {
    if(err) {
      console.log(err)
    } else {
    console.log(users);
    }
  });

  • POST Request
const data = {
    "name": "Bolaji Ayodeji",
    "username": "bolajiayodeji",
    "email": "hi@bolajiayodeji.com",
    "address": {
      "street": "Hello world",
      "suite": "Hello",
      "city": "Lokoja, Kogi",
      "zipcode": "xxx-xxx-xxx",
      "geo": {
        "lat": "29.4572",
        "lng": "-164.2990"
      }
    },
    "phone": "+234 8109445504",
    "website": "https://bolajiayodeji.com",
    "company": {
      "name": "PhilanthroLab",
      "catchPhrase": "Multi-tiered zero tolerance productivity",
      "bs": "transition cutting-edge web services"
    }
};

http.post('https://jsonplaceholder.typicode.com/users',
  data, (err, user) => {
    if(err) {
      console.log(err)
    } else {
      console.log(user);
    }
  });

  • PUT Request
const data = {
    "name": "Bolaji Ayodeji",
    "username": "bolajiayodeji",
    "email": "hi@bolajiayodeji.com",
    "address": {
      "street": "Hello world",
      "suite": "Hello",
      "city": "Lokoja, Kogi",
      "zipcode": "xxx-xxx-xxx",
      "geo": {
        "lat": "29.4572",
        "lng": "-164.2990"
      }
    },
    "phone": "+234 8109445504",
    "website": "https://bolajiayodeji.com",
    "company": {
      "name": "PhilanthroLab",
      "catchPhrase": "Multi-tiered zero tolerance productivity",
      "bs": "transition cutting-edge web services"
    }
};

http.put('https://jsonplaceholder.typicode.com/users/1',
  data, (err, user) => {
    if(err) {
      console.log(err)
    } else {
      console.log(user);
    }
  });

  • DELETE Request
users = http.delete('https://jsonplaceholder.typicode.com/users/1',
(err, response) => {
  if(err) {
    console.log(err)
  } else {
  console.log(response);
  }
});

Demo

Demo here

Contribution Guide

git clone https://github.com/BolajiAyodeji/simple-ajax-library.git
cd simple-ajax-library
npm install
npm run build
You can’t perform that action at this time.