2013-08-19 103 views
0

I have a div, which is in a link href tag:如何讓<a href..> not refresh the page

<a href="banana.html"><div id="somediv">Some Div</div></a> 

when I click on the div, the entire page unloads and reloads with banana.html. However, I'm using websocket and need only a part of the page to reload, is there a way to change the window url without refreshing the page?

Thanks!

+0

閱讀AJAX。 https://developer.mozilla.org/en/docs/AJAX –

+3

['history.pushState()'](https://developer.mozilla.org/en-US/docs/Web/Guide/DOM/Manipulating_the_browser_history# The_pushState()。C2.A0方法)([瀏覽器支持](http://caniuse.com/history))。 –

+0

有沒有辦法用簡單的javascript/jquery函數做到這一點? –

回答

相關問題