Skip to content

Instantly share code, notes, and snippets.

@dymurray
Created March 11, 2019 22:53
Show Gist options
  • Save dymurray/d31fc811383ce455516722c995c5c58a to your computer and use it in GitHub Desktop.
Save dymurray/d31fc811383ce455516722c995c5c58a to your computer and use it in GitHub Desktop.
<html lang="en">
<div id="result">
</div>
<script>
var HttpClient = function() {
this.get = function(aUrl, aCallback) {
var anHttpRequest = new XMLHttpRequest();
anHttpRequest.onreadystatechange = function() {
if (anHttpRequest.readyState == 4 && anHttpRequest.status == 200)
aCallback(anHttpRequest.responseText);
}
anHttpRequest.open( "GET", aUrl, true );
anHttpRequest.setRequestHeader("key", "1EJfgCAb5UQXL4cqGdsekuToL5dSjCvHWp" );
anHttpRequest.send( null );
}
}
var client = new HttpClient();
client.get('https://genesis.bitdb.network/q/1FnauZ9aUH2Bex6JzdcV4eNX7oLSSEbxtN/ewogICJ2IjogMywKICAicSI6IHsKICAgICJmaW5kIjogeyJvdXQuaDEiOiAiODA4MCIsICJvdXQuczIiOiAiQm9iIER5bGFuIiwgIm91dC5zMyI6ICJCbG9uZGUgb24gQmxvbmRlIiwgIm91dC5zNCI6ICJWaXNpb25zIG9mIEpvaGFubmEifSwKICAgICJsaW1pdCI6IDEwCiAgfSwKICAiciI6IHsKICAgICJmIjogIlsgLltdIHwgeyBodG1sOiAub3V0WzBdLmxzNX1dIgogIH0KfQ==', function(response) {
var html = JSON.parse(response)
console.log(html.u[0].html)
document.getElementById("result").innerHTML = html.u[0].html;
})
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment