iHTTP is a simple JavaScript library for making simple json based http(ajax) requests.
- [JS promises] (https://caniuse.com/#feat=promises)
- [JS Async-Await] (https://caniuse.com/#feat=async-functions)
- [JS Fetch Api] (https://caniuse.com/#feat=fetch)
** Note: ** This library uses modern Javascript ES6 features like arrow functions.
To start using the library just include one of the two JS files in your app
<script src="/ihttp-async.js"></script>
To start using the library first intialize instance of the library
const http = new iHTTP(); //initialize and load iHTTP library instance
Example call get function with URL as a parameter
http.get(url)
.then(response => console.log(response))
.catch(error => console.log(response));
Example call post function with URL as a parameter
const data = {
name: 'john doe',
username: 'johny',
email: 'johnyy@john.com'
}
http.post(url, data)
.then(response => console.log(response))
.catch(error => console.log(response));
Example call put/update function with URL & data as a parameter
const data = {
name: 'john doe',
username: 'johny',
email: 'johnyy@john.com'
}
http.put(url, data)
.then(response => console.log(response))
.catch(error => console.log(response));
Example call delete function with URL as a parameter
http.delete(url)
.then(response => console.log(response))
.catch(error => console.log(response));
Include clone the library to local and open index.html
- index.html
- demo.html