I'd like to ask, how can i make a $.tmpl ready function?
In my code I pass the ajax json to my createForm function.
var doFunction = {
new: function() {
$.ajax({
url: 'index.php?...',
success: function(data) {
createForm(data).appendTo($("#whitespace"));
$("#whitespace").click(function(){
$(this).empty().hide();
});
$("#popup").click(function(e){
e.stopPropagation();
});
$("#whitespace").show();
}
});
},
The createForm function
function createForm(data) {
var $container = $('<div id="popup"></div>');
var $content = $('<article></article>');
$.get('mydomain.com/formcreator.htm', function(template) {
$.tmpl(template, data).appendTo($content);
});
$content.appendTo($container);
return $container;
}
But if I tell the $container
to $container.find(".tabs").tabs();
- it contains an <div class="tabs>...etc...</div>
.
I think the problem is I did not catched the $.tmpl finish event.
Is there a success event of the $.tmpl?
Please help me in this.