我正在尝试在我的 Web 应用程序中使用 pushState,如下所示:
//default settings
var ds = {
path: window.module.Globals.prototype.base_url, //location misc variable for my app
type: 'POST',
dataType: 'html',
data: {},
target: 'main_swap_area',
pre_ajax_callback: function(scope){ console.log('pac'); },
post_success_callback: function(data, textStatus, jqXHR, scope){ console.log('psc'); },
scope: this
};
History.pushState(ds, 'Title 1', ds.path);
我有一个回调函数监听“ statechange
”事件
jQuery(window).bind('statechange',function(){
var
State = History.getState(),
url = State.url;
console.log(State); // State.data is object with all original properties EXCEPT properties that contained functions as values
}); // end onStateChange
我的控制台的输出是一个包含我所有原始属性/值的对象,但所有具有值函数的属性除外。为什么这些被丢弃/不被退回?