Newer
Older
"use strict";
function fetchjson(url) {
return new Promise((resolve, reject) => {
const headers = new Headers();
headers.append("Accept", "application/json");
fetch(url, { mode: "no-cors", headers })
.then(r => r.json())
.then(r => resolve(r))
.catch(e => reject(e));
});
const headers = new Headers();
headers.append("Accept", "text/html");
.then(r => r.text())
.then(r => resolve(r))
.catch(e => reject(e));
});