Reputation: 27
Hi guys i'm working on a web app using Jquery mobile and Ajax. There is a page with a menu on left and when i click on the items it loads some other pages in the right side div.
I'm using Ajax to open other pages in the Jquery Mobile App , the problem is when i click on links in the pages it does not open in the same div. like here:
$.ajax({
url: "sendrequestslist.php"
}).done(function(data) {
$("#content").html(data);
});
How can i open the links in sendrequestslist.php
in the same page (in #content div).
Thanks guys , really appreciate the help
Upvotes: 0
Views: 535
Reputation: 1
Try using event delegation, .html()
$("#content").on("click", "a", function(e) {
e.preventDefault();
var html = $(this.href);
$("#content").html(html)
})
Upvotes: 1