开发者

How do i make JQuery react when the hashtag in the url changes?

开发者 https://www.devze.com 2023-03-26 08:03 出处:网络
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

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.)

开发者_运维知识库I think I should use the hash tag in the URL for this, but I'm very open for other suggestions.

Anyways how do I load my ajax when the hash tag changes without having reloading the page?


You don't need to use any plugins to get it to work.

From On - window.location.hash - Change?

$(window).on('hashchange', function() {
    .. work ..
});


Use address jquery plugin and its .change() functionality


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消