UNPKG

vanilla-js

Version:

jQuery-like Aliases (NOT Wrappers) to HTML5 Selector API / Raw Document

22 lines (20 loc) 496 B
// Generated by CoffeeScript 1.4.0 $.xhr = function(method, url, data, cb) { var r; try { r = new XMLHttpRequest(); r.open(method, url, true); r.onreadystatechange = function() { if (r.readyState !== 4) { return; } if (r.status !== 200) { return cb(r.statusText, null, r.status, r); } return cb(null, r.responseText, r.status, r); }; r.send(data || undefined); } catch (err) { return cb(err, null, r.status, r); } };