好的,我发现了问题,hash.location 没有更新到点击/点击的链接(剧院)。
我使用 data-url 属性来提取正确的信息:
例子:
$(document).on('pagechange', function (e, o) {
var dataURL = $('#theater').attr('data-url'); // Use this for the Theater Location as hash is not updating
var hash = location.hash;
var action = hash.split('?')[0]; // #whatshot, #showtimes, #zip?{zip}, #theater?{zip},{theaterId}
var args = dataURL.split('?')[1].split(',');
var zip = args[0];
var theaterId = args[1];
// load theater movies
codejkjk.movies.Api.GetTheaterMovies(codejkjk.movies.Mobile.Currents.ShowtimeDay(), codejkjk.movies.Mobile.Currents.ZipCode(), theaterId, function (theater) {
codejkjk.movies.Mobile.Controls.CurrentTheater().html(theater.name);
codejkjk.movies.Mobile.Controls.TheaterMovieList().html(
codejkjk.movies.Mobile.Controls.TheaterMovieTemplate().render(theater)
).show().listview('refresh'); //.trigger('create');
// set theaterMovieBackUrl
theaterMovieBackUrl = hash; // set back url to current url
$.mobile.hidePageLoadingMsg();
});
});
我在 Chrome 控制台中使用了这个功能