我學習Ĵ查詢,我想送的ID在當前的URL,然後UL李上點擊事件時發送ID在當前URL不刷新頁面如何使用Jquery在當前URL中發佈id?
像這樣:
Current URL = localhost/backupapp-latest-21-05/index.php?r=site/Application<br>
send id url = localhost/backupapp-latest-21-05/index.php?r=site/Application&abcid=48
有一個abcid = 48是我UL李ID
試試這個代碼:
$(document).ready(function(e) {
$('#hari-ul > li').each(function(index, element) {
$(element).click(function(e) {
var id = (this.id);
window.location.href = "index.php?r=site/Application&abcid="+id;
}
});
});
});
該代碼的URL,但頁面刷新發送ID,我想沒有頁面ID刷新
star t學習AJAX –
你在代碼中有一個額外的'}' – fcalderan
可能重複[在JavaScript中獲取查詢字符串值](http://stackoverflow.com/questions/901115/get-query-string-values-in-javascript ) – HackedByChinese