Comparing version 3.0.3 to 3.0.4
{ | ||
"name": "minixhr", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"description": "super simpel and small cross-browser xhr", | ||
@@ -5,0 +5,0 @@ "main": "minixhr.js", |
# minixhr | ||
super simpel and small cross-browser xhr | ||
super simple and small cross-browser XMLHttpRequest (XHR) | ||
@@ -8,3 +8,3 @@ # USAGE | ||
function responseHandler (data, response, xhr, header) { | ||
var callback = function responseHandler (data, response, xhr, header) { | ||
console.log(data) | ||
@@ -14,5 +14,5 @@ } | ||
var request = { // can be 'url string' or object: | ||
url : 'http://jsonplaceholder.typicode.com/posts/1', | ||
url : 'http://requestb.in/18b4srl1', | ||
method : 'POST', // [optional] (defaults to 'GET') | ||
body : 'payload', // [optional] payload data could be <formdata> or {key:val}'s or anything | ||
body : '{ "foo": 123, "bar": "abc" }', // [optional] payload data could be <formdata> or {key:val}'s or anything | ||
headers : {} // [optional] (defaults to '{}' or in case of 'POST': | ||
@@ -23,11 +23,7 @@ // {'X-Requested-With':'XMLHttpRequest','Content-Type':'application/x-www-form-urlencoded' } ) | ||
// EXAMPLE 1 | ||
var callback = responseHandler | ||
minixhr(request, callback) // [optional] callback - (e.g. leave out for POST Request where you don't care about a response | ||
// EXAMPLE 2 | ||
minixhr('http://requestb.in/18b4srl1', function (data) { console.log(data) }) | ||
minixhr('http://jsonplaceholder.typicode.com/posts/1', callback) | ||
// check http://requestb.in/18b4srl1?inspect afterwards to inspect | ||
// EXAMPLE 3 - github | ||
minixhr() | ||
``` |
3315
27