[英]Make background image clickable with other links and elements inside the same div
[英]Make links contained in Ajax open in same div
嗨,大家好,我正在使用Jquery mobile和Ajax開發Web應用程序。 有一個頁面的左側菜單,當我單擊該項目時,它會在右側div中加載其他頁面。
我正在使用Ajax在Jquery Mobile App中打開其他頁面,問題是當我單擊頁面中的鏈接時,該鏈接未在同一div中打開。 像這兒:
$.ajax({
url: "sendrequestslist.php"
}).done(function(data) {
$("#content").html(data);
});
如何在同一頁面(在#content div中)打開sendrequestslist.php
中的鏈接。
謝謝大家,非常感謝您的幫助
嘗試使用事件委托.html()
$("#content").on("click", "a", function(e) {
e.preventDefault();
var html = $(this.href);
$("#content").html(html)
})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.