Created
August 28, 2012 09:11
-
-
Save ynonp/3496418 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
"http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<title>Ultimate War</title> | |
</head> | |
<body> | |
<h1>Score</h1> | |
<div id="score"></div> | |
<script type="text/template" id="tmpl-score"> | |
<h3>Humans: {{humans}}</h3> | |
<h3>Zombies: {{zombies}}</h3> | |
</script> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0.beta6/handlebars.min.js"></script> | |
<script src="game.js"></script> | |
</body> | |
</html> |
This file contains hidden or 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
/** | |
* Created with JetBrains WebStorm. | |
* User: ynonperek | |
* Date: 8/28/12 | |
* Time: 11:28 AM | |
* To change this template use File | Settings | File Templates. | |
*/ | |
$(function() { | |
var template = Handlebars.compile( $('#tmpl-score').html() ); | |
function show_data( data ) { | |
var result = template( data ); | |
$('#score').html( result ); | |
} | |
$.ajax({ | |
type: 'GET', | |
dataType: 'json', | |
url: '/data.php', | |
success: show_data | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment