Skip to content

Instantly share code, notes, and snippets.

View TFrascaroli's full-sized avatar

Timoteo Frascaroli TFrascaroli

View GitHub Profile
@lyoshenka
lyoshenka / xhr.js
Last active November 14, 2016 09:27
Simple JS AJAX wrapper that supports JSONP too.
/*
Usage:
xhr('GET', '/endpoint')
.success(function (data) { console.log(data); alert('AJAX success'); })
.error(function (data) { console.log(data); alert('AJAX ERROR'); });
*/
xhr = function (type, url, data) {
var methods = {