var url = api_url + 'getblock' var elem = document.getElementsByTagName('div')[0]; let button = document.getElementsByTagName('button')[0]; let promised_peerid = fetch(url). then(resp => resp.json()). then(obj => { console.log('peerid.obj:',obj); let buf = elem.innerHTML; buf = buf.replace(':peerid',obj.peerid); buf = buf.replace(':name',obj.name); elem.innerHTML = buf; return obj }). catch(console.error); console.log('peerid.js loaded');