内容简介:似乎pjax是您正在寻找的图书馆:翻译自:https://stackoverflow.com/questions/12359895/listening-to-browser-back-button-when-using-ajax-and-saving-the-html-data-as-an
(一个 php 人)的新手.在重新发明之前,我已经在整个网络上搜索了一个库.但是由于我在ajax链接中使用了很多参数,我无法使用这些库.我承认我的错误,因为我不知道如何使用这种复杂的系统.所以我在想如果创建一个系统如下.
// get the contents of a particular div and save as an object/associative array
// { hash : pageNumber, html : content}
function save_history(div){
var content = $(div).html();
// increment the page number and add hash tags to the URL
}
// Listen to the browser hash value change
$(window).bind('hashchange', function () {
hash = window.location.hash;
if(hashValue){
load_history(hashValue);
}
});
// Load data from history
function load_history(id){
// fetch the content based on the hashvalue
$(div).html(content);
}
使用它有什么问题吗?当许多内容被保存为对象时,这会使页面无响应或崩溃浏览器吗?如果它导致这样的问题,我不想浪费我的时间.
似乎pjax是您正在寻找的图书馆: https://github.com/defunkt/jquery-pjax
翻译自:https://stackoverflow.com/questions/12359895/listening-to-browser-back-button-when-using-ajax-and-saving-the-html-data-as-an
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- javascript – 在jQuery datepicker上聆听onChange?
- vue router路由自定义后退事件,并通知下个路由为后退
- 聆听中国开源最强音 | 国内大厂开源项目齐聚 OSCAR 开源先锋日
- jquerymobile后退按钮未显示在标题上
- vue路由里前进后退的那些事儿
- vue拦截(阻止)浏览器后退事件
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Algorithms
Sanjoy Dasgupta、Christos H. Papadimitriou、Umesh Vazirani / McGraw-Hill Education / 2006-10-16 / GBP 30.99
This text, extensively class-tested over a decade at UC Berkeley and UC San Diego, explains the fundamentals of algorithms in a story line that makes the material enjoyable and easy to digest. Emphasi......一起来看看 《Algorithms》 这本书的介绍吧!