Last active
September 14, 2018 10:51
-
-
Save hussaintamboli/523004b1b7ad806a66cc861e7bebc302 to your computer and use it in GitHub Desktop.
Web Snippets for Pinn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- START OF USER'S CODE --> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<!-- USER COPIES BELOW CODE SNIPPET AND ADDS TO HIS APP --> | |
<div id="app123"> | |
</div> | |
<script id="jsbin-source-javascript" type="text/javascript"> | |
fetch('http://www.mocky.io/v2/5b614e96300000d9046a404c') | |
.then(function(response) { | |
return response.json(); | |
}).then(function(data) { | |
var div = document.getElementById("app123"); | |
div.style["text-align"] = "center"; | |
div.style["color"] = "red"; | |
var span = document.createElement('span'); | |
span.appendChild(document.createTextNode(data.title)); | |
div.appendChild(span); | |
var p = document.createElement('p'); | |
p.appendChild(document.createTextNode(data.details)); | |
div.appendChild(p); | |
}).catch(function(err) { | |
console.log(err.stack); | |
}); | |
</script> | |
<!-- END OF CODE SNIPPET --> | |
</body> | |
</html> | |
<!-- END OF USER'S CODE --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- START OF USER'S CODE --> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<!-- USER COPIES BELOW CODE SNIPPET AND ADDS TO HIS APP --> | |
<div id="app123"> | |
</div> | |
<script id="jsbin-source-javascript" type="text/javascript"> | |
fetch('http://www.mocky.io/v2/5b614e96300000d9046a404c') | |
.then(function(response) { | |
return response.json(); | |
}).then(function(data) { | |
var div = document.getElementById("app123"); | |
div.classList.add("panel"); | |
div.classList.add("panel-default"); | |
var headDiv = document.createElement('div'); | |
headDiv.classList.add("panel-heading"); | |
headDiv.appendChild(document.createTextNode(data.title)); | |
div.appendChild(headDiv); | |
var bodyDiv = document.createElement('div'); | |
bodyDiv.classList.add("panel-body"); | |
bodyDiv.appendChild(document.createTextNode(data.details)); | |
div.appendChild(bodyDiv); | |
}).catch(function(err) { | |
console.log(err.stack); | |
}); | |
</script> | |
<!-- END OF CODE SNIPPET --> | |
</body> | |
</html> | |
<!-- END OF USER'S CODE --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PS: I know this is not the right place.
But here is the android snippet.