How to paginate with ajax jquery in codeigniter? |
Hi,
I don't know how to paginate with ajax jquery in codeigniter, please help me. Thanks.
I would start with the docs for pagination. http://www.codeigniter.com/user_guide/li...ation.html
Adding in Ajax would mean recalling the page contents using your pagination system to deliver the new content via an ajax call in js. Using Jquery would mean writing your ajax call using jquery JS library. What you are asking is quite complicated and would take an age to answer. Start with non-ajax delivery of pagination links via CI library and once that is working you can then use JS to put it into an ajax call. Best wishes, Paul.
Thank for your reply.
I have done with non-ajax delivery of pagination links via CI library, it's no problem. Here's my code with ajax, it doesn't respond as i click page link! - View: page_view_ajax.php - Model: page_model.php - Controller: Page_ajax.php 1. View: page_view_ajax.php Code: <!DOCTYPE html> 2. Controller: Page_ajax.php Code: <?php 3. Model: page_model Code: <?php Thanks.
There are two obvious issues with your view:
1. Start with the page you generated via CodeIgniter's pagination library. Don't waste your user's time sending the templated HTML without any content in the table and pager, especially since you've hard-coded the first page into your document-ready script (and you can take that out if you start with the content already filled in). This has the added benefit of (hopefully) continuing to work if the user disables JavaScript. 2. Your script is defining a click-handler with an invalid selector, there's nothing on the page with an id of "paginator".
If you already have a non-AJAX implementation, a possible way to continue is to have a look at the following project: https://github.com/defunkt/jquery-pjax
Thank you for all,
I'm a newbie about codeigniter. So, could you show me how to solve this issue with the code posted here? BR, |
Welcome Guest, Not a member yet? Register Sign In |