history.js
history.js copied to clipboard
Is there a method or property to solve my problem?
Hi, Dear author, I use your api in my project. when i click the next page button, it will send the same request two times.
-
First i push a state when click the next page button; submitAsJson(data, url, function (result) { (function (window, undefined) { var History = window.History; if (History.enabled) { var stateData = {}; stateData.url = url; stateData.data = data; History.pushState(stateData, '', '/staff/staffoverview.do'); } })(window);
$("#staffDiv").html(result);});
2.Second i registe the statechange event (function (window, undefined) { History.Adapter.bind(window, 'statechange', function () { var stateData = History.getState().data;
submitAsJson(stateData.data, stateData.url, function (result) {
$("#staffDiv").html(result);
})
});
})(window);