Skip to content

Instantly share code, notes, and snippets.

@Joseph7451797
Last active March 18, 2016 09:22
Show Gist options
  • Save Joseph7451797/cf8139f4932716d6d129 to your computer and use it in GitHub Desktop.
Save Joseph7451797/cf8139f4932716d6d129 to your computer and use it in GitHub Desktop.
JS Bin// source http://jsbin.com/goyehu
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<div id="img-wrapper"></div>
<script id="jsbin-source-javascript" type="text/javascript">
fetch('https://dl.dropboxusercontent.com/u/43833728/imgsccreq.json').then(function(response) {
return response.json(); // Convert to JSON
}).then(function(j) {
var nnn = [];
var length;
var docfrag = document.createDocumentFragment();
if(j instanceof Array) {
j.map(function(k) {
nnn.push(k.url);
});
length = nnn.length;
}
for(i = 0; i < length; i++){
var t = document.createElement("img");
t.setAttribute("src", nnn[i]);
docfrag.appendChild(t);
}
document.getElementById("img-wrapper").appendChild(docfrag);
}).catch(function(err) {
console.log(err); // Error :(
});
</script>
</body>
</html>
fetch('https://dl.dropboxusercontent.com/u/43833728/imgsccreq.json').then(function(response) {
return response.json(); // Convert to JSON
}).then(function(j) {
var nnn = [];
var length;
var docfrag = document.createDocumentFragment();
if(j instanceof Array) {
j.map(function(k) {
nnn.push(k.url);
});
length = nnn.length;
}
for(i = 0; i < length; i++){
var t = document.createElement("img");
t.setAttribute("src", nnn[i]);
docfrag.appendChild(t);
}
document.getElementById("img-wrapper").appendChild(docfrag);
}).catch(function(err) {
console.log(err); // Error :(
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment