I can set the data in State.data of History.js, for example:
var pushStateData = {}; function RetrieveSearchResults(type, url, searchData) {//, showResetButton, controlToFocus, navDirection) { pushStateData = { SearchType : type, SearchData : searchData, }; RetrievePageResults(true, url, pushStateData); } function RetrievePageResults(pushNewUrl, url, pushStateData) { navigationInProgress = true; if (pushNewUrl) { if (window.History) { window.History.pushState(pushStateData, null, url); } $.get(url, pushStateData.SearchData, function (reply) { $("#search-results").html(reply); navigationInProgress = false; }); }
If I set a breakpoint in window.History.pushState, in Chrome I clearly see that pushStateData has the right values.
However, when I try to get the data:
$(window).bind("statechange", function (e) { if (!navigationInProgress) { var State = window.History.getState(); if (window.console && window.console.log) { console.log("popstate", State, window.location.href); } RetrievePageResults(false, State.cleanUrl, State.data); } });
When I set a breakpoint in the RetrievePageResults statement, the State.data object no longer has the values ββthat I set. State.data is defined and not null, but it is an empty object with no visible values.
Thanks Scott
sveatch42
source share