базовый класс:
function Widget(block, options) {
this.options = eval(options);
this.block = $(block);
var self = this;
// this.options.widget = this.block.attr('widget');
this.render = function(result_container) {
if (result_container == undefined) result_container = this.block;
$.ajax({
url: "/widget/",
type: "GET",
data: {"options": JSON.stringify(this.options) },
success: function (result) {
$(result_container).empty().html(result); // empty добавил только что и тестю
manager.run();
}
});
};
this.query = function(request_handler) {
$.ajax({
url: "/widget/",
type: "GET",
data: {"options": JSON.stringify(this.options) },
success: function (result) {
request_handler(result);
}
});
};
this.replaceRender = function() {
$.ajax({
url: "/widget/",
type: "GET",
data: {"options": JSON.stringify(this.options) },
success: function (result) {
self.block.replaceWith(result);
manager.run()
}
});
};
}