Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Object JavaScript - Loading Template Using Infuser
<title>Basic Example</title>
<p>Try this in Chrome, while watching requests on the "Network" tab of the developer tools.</p>
<input id="btnTemplate" type="button" value="Say Hello!">
<span id="msg"></span>
<div id="target"></div>
<script type="text/javascript" src="Scripts/jquery-2.0.0.js"></script>
<script type="text/javascript" src="Scripts/TrafficCop.js"></script>
<script type="text/javascript" src="Scripts/infuser.js"></script>
var toggled = false;
$(function () {
$('#btnTemplate').click(function () {
infuser.defaults.templateUrl = "./Templates",
infuser.get("Hello", function (template) {
var target = $("#target");
if (!toggled) {
$("#msg").text("Next click uses a locally cached template");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment