(NOTE: This is very old, and the functions aren't even helpful compared to other libraries that do the same. I don't even think the ES6Arrayfunctions.js files worked at all. Im only keeping this so you can look/laugh at my past mistakes)
These are some short libraries i make to help myself.
--> reqSender.js
--> Credits
This library is made to bring the glorius ES6 arr.(map || filter || reduce) into older javascript versions.
To use just link either the ES6Arrayfunctions.js or the minified ES6Arrayfunctionsmin.js.
This library is made to easily send get/post/put/patch/detete reqests, it has both synchronous and asynchronous support. It is also backwards compatible, since i had a hard time not using arrow functions and other things
Remember to link either reqSender.js or the minified reqSendermin.js in your head tag
To send a synchronous request to any url you use getDataSync(method : ('get' || 'post' || 'put' || 'patch' || 'delete'), url : String); -> returns an XMLHttpRequest object with all of your data
// Send a synchronous get reqest to '/data.json' and console.log it
var data = JSON.parse(getDataSync('get', '/data.json').responseText);
console.log(data)
To send an asynchronous request to any url you use getDataAsync(method : ('get' || 'post' || 'put' || 'patch' || 'delete'), url : String, callbackfn : function(request : XMLHttpRequest object with all of your data));
// Send an asynchronous get reqest to '/data.json' and console.log it
getDataAsync('get', '/data.json', function(req) {
var data = JSON.parse(req.responseText);
console.log(data);
});
All of the minified scripts were made though this js minifier.