mirror of
https://github.com/liriliri/eruda.git
synced 2026-03-20 09:38:37 +08:00
19 lines
359 B
JavaScript
19 lines
359 B
JavaScript
function exports(url, cb)
|
|
{
|
|
var xhr = new window.XMLHttpRequest();
|
|
|
|
xhr.onload = function ()
|
|
{
|
|
var status = xhr.status;
|
|
|
|
if ((status >= 200 && status < 300) || status === 304)
|
|
{
|
|
cb(null, xhr.responseText);
|
|
}
|
|
};
|
|
|
|
xhr.onerror = function () { cb(xhr) };
|
|
|
|
xhr.open('GET', url);
|
|
xhr.send();
|
|
} |