0

我对绑定到文档对象的自定义事件有疑问。我的应用分为几个文件,这里只是一个例子:

事件.js

(function($){

    $(document).on("updateCommentsView", function(e, data){
        console.debug(e, data);
    });

})(jQuery);

应用程序.js

// some code with functions inside .ready(), then
window.foo(formData, function(r){
    $(document).trigger("updateCommentsView", [{"formData":formData, "response": r}]);
});

问题

每当我刷新页面(使用F5或刷新按钮或任何其他方法,包括location.reload())时,我的自定义绑定events.js都消失了。但是,如果我Enter在地址栏中点击,一切都很好。有什么想法吗?

4

0 回答 0