Answers for "jquery template tutorial"

1

jquery template tutorial

<html>
<head>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.2.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.js"></script>
</head>

<body>
<div id="myContent"></div>

<script>
$(document).ready(function() {
$.ajax({
dataType: "jsonp",
url: "replace_with_your_url_that_returns_json",
jsonp: "$callback",
success: showData
});
});

function showData(data) {
// Use the template
$("#myTemplate").tmpl(data).appendTo("#myContent");
}
</script>

<script id="myTemplate" type="text/x-jquery-tmpl">
<div class="profile">
<div class="thumbnail"><img src="${Thumbnail}" alt="" /> </div>
<div>
<span>${Name}</span>
<p>${Bio}</p>
</div>
</div>
</script>
</body>
</html>
Posted by: Guest on March-23-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language