The jQuery template:
<script id="bookTemplate" type="text/x-jquery-tmpl">
<tr>
<td>${Author}</td>
<td>${Title}</td>
<td>${Subject}</td>
</tr>
</script>
Template being used:
$('#authors').change(function () {
var author = $('#authors').val();
api.getBooksByAuthor({
success: function (result) {
$('#bookTableBody').empty();
$('#bookTemplate').tmpl(result).appendTo('#bookTableBody');
}
}, author);
});
Example HTML code where the table cell content is applyed:
<table width="600"> <thead> <tr> <th>Author</th> <th>Title</th> <th>Subject</th> </tr> </thead> <tbody id="bookTableBody"> </tbody> </table>
Comments
Post a Comment