Reputation: 23
I am new to CakePHP. I have installed CakePHP 3.2.10.
I have implemented simple AJAX calls. I have also implemented pagination in normal view.
Now I want to show records, loading with AJAX and using pagination.
Can anyone guide me how to go about doing this?
I have referred to the cookbook but did not get proper information.
Do I create a normal action and view with pagination code ?
Upvotes: 1
Views: 909
Reputation: 8496
Simply, you can use liveQuery Javascript library. you can download from here
Add Below Code in Javascript
function ajaxPageLoader(request_url) {
console.log("Content loading from : "+request_url);
$("#wrapper").load(request_url + " #wrapper", function() {
window.history.pushState({}, "", request_url);
console.log("Content loaded");
});
}
$(document).ready(function(){
$('your_pagination_link_selector').livequery(function() {
$(this).unbind('click').bind('click', function(e) {
e.preventDefault();
ajaxPageLoader($(this).attr('href'));
return false;
})
});
});
Upvotes: 1