0
我搜索了幾個小時,並在jquery中找到了一個修改當前頁面url的腳本。例如使用jQuery修改url參數而無需刷新頁面
?profile_id=<%=(rs_resq.Fields.Item("profile_id").Value)%>#inter
但是,當我使用它的頁面重新加載,我鬆開了DOM中的所有以前的緩存數據。我想這背後發生的原因是鏈接屬性
rel="external"
所以我把它關閉,然後停止工作。
<script>
$("#inter").live("pageshow", function onPageShow(e,data){
alert('Page 2 - CID: ' + getParameterByName('profile_id'));
});
function getParameterByName(name) {
var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
</script>
您正在使用哪個jQuery版本?從1.9版開始,「live()」被刪除。選中[this](http://api.jquery.com/live)。 – Preetesh 2015-02-07 10:17:55
我使用的版本是1.8.4 – 2015-02-07 10:19:26
你到底想要做什麼?還有其他方法可以做任何事情。如果你希望內容在沒有頁面改變的情況下改變,那麼你可以使用JS來做到這一點.. JS可以與服務器通信並獲取數據,從div中刪除數據並在不刷新的情況下添加新的數據。您也可以使用AJAX調用PHP函數。 – bakriawad 2015-02-07 13:16:50