I've been trying to implement a history plugin called really simple history, and I think I've succeeded with that. So now I want to make my ajax to react when the history changes (you press the back or forward button.)
我一直在尝试实现一个名为简单历史的历史插件,我想我已经成功了。所以现在我想让我的ajax在历史记录发生变化时做出反应(按下后退或前进按钮。)
I think I should use the hash tag in the URL for this, but I'm very open for other suggestions.
我想我应该在URL中使用hash标签,但我对其他建议非常开放。
Anyways how do I load my ajax when the hash tag changes without having reloading the page?
无论如何,当哈希标签更改而不重新加载页面时,如何加载我的ajax?
3 个解决方案
#2
4
You don't need to use any plugins to get it to work.
您不需要使用任何插件来使其工作。
From On - window.location.hash - Change?
从On - window.location.hash - 改变?
$(window).on('hashchange', function() {
.. work ..
});
#3
0
im not sure if i understand what you want, but with RSH when the hash changes the function you added with dhtmlHistory.addListener(someFunction);
gets executed.
我不确定我是否理解你想要的东西,但是当哈希改变你用dhtmlHistory.addListener(someFunction)添加的函数时使用RSH;被执行。
#1
#2
4
You don't need to use any plugins to get it to work.
您不需要使用任何插件来使其工作。
From On - window.location.hash - Change?
从On - window.location.hash - 改变?
$(window).on('hashchange', function() {
.. work ..
});
#3
0
im not sure if i understand what you want, but with RSH when the hash changes the function you added with dhtmlHistory.addListener(someFunction);
gets executed.
我不确定我是否理解你想要的东西,但是当哈希改变你用dhtmlHistory.addListener(someFunction)添加的函数时使用RSH;被执行。