Last active
April 7, 2016 20:53
-
-
Save tmcw/5962074 to your computer and use it in GitHub Desktop.
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
{"message":"Hi"} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<link rel="stylesheet" href="https://yandex.st/highlightjs/7.3/styles/default.min.css"> | |
<script src="https://yandex.st/highlightjs/7.3/highlight.min.js"></script> | |
<script src="https://code.jquery.com/jquery-1.10.1.min.js"></script> | |
<style> | |
body, pre { | |
margin:0; padding:0; font:normal 12px/20px sans-serif; | |
} | |
.left { | |
background:#ccc; | |
text-align:center; | |
} | |
.left, .right { | |
width:50%; | |
float:left; | |
} | |
.pad { | |
padding:10px; | |
} | |
</style> | |
</head> | |
<body> | |
<div class='left'> | |
<div class='pad'> | |
<h2 id='hi'></h2> | |
</div> | |
</div> | |
<div class='right'> | |
<pre><code id='code' class='javascript'>// a callback can be an anonymous function | |
$.getJSON('hello.json', function(hello) { | |
$('#hi').text(hello.message); | |
}); | |
var message = $('#hi').text(); | |
$('#hi').text(message + ', Tom'); | |
</code></pre> | |
</div> | |
<script type='text/javascript'> | |
eval($('#code').text()); | |
hljs.initHighlightingOnLoad(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment