Skip to content

Instantly share code, notes, and snippets.

@tmcw
Last active April 7, 2016 20:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmcw/5962074 to your computer and use it in GitHub Desktop.
Save tmcw/5962074 to your computer and use it in GitHub Desktop.
{"message":"Hi"}
<!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