JavaScript删除对象

JavaScript删除对象,javascript,class,object,Javascript,Class,Object,我正在做一些ajax请求并加载一些新内容。 在我的主页中,我正在使用: var App = function($el) { this.$el = $el; if ($.isFunction(this.init)) this.init(); } App.prototype = { init: function() { console.log(this); } } $(function() { var $homepage

我正在做一些ajax请求并加载一些新内容。 在我的主页中,我正在使用:

var App = function($el) {
    this.$el = $el;
    if ($.isFunction(this.init)) this.init();
}

App.prototype = {
    init: function() {          
        console.log(this);
    }
}

$(function() {
    var $homepage = $('#app #projects');
    $homepage = new App($homepage);
});

我尝试在加载新内容时重置对象,然后在返回主页时创建新内容。有什么想法吗?

我没有看到任何ajax请求。。。这就是你的全部代码吗?不,在我的ajax请求中,我只是删除了我的div项目,并添加了一个新的(#demo)和数据结果。