Hey!
The following code:
jQuery(document).ready(function($) {
function getBooks() {
var query = "ajax.php?do=allbooks";
$.ajax({
dataType: "jsonp",
url: query,
jsonp: "callback",
success: showBooks
});
}
function showBooks(data) {
$("#bookTmpl").tmpl(data, {
getName: function() {
return 'bla';
}
}).appendTo( "#test" );
}
getBooks();
});
What I am trying to do is use the getName()-function in my template.
Let's pretend my template looks like this:
<script id="bookTmpl" type="text/x-jquery-tmpl">
<li>
${title} by ${author}<br />
Rating: ${rating} -> ${getName()}
</li>
</script>
What do I have to change to make it work? Right now, the function isn't even executed. Everything else works.