Javatpoint Logo
Javatpoint Logo

PHP Codeigniter 3 Ajax Pagination using Jquery

In this section, we are going to learn about ajax pagination in Codeigniter 3. We will use JQuery to do this. Every website developer wants to make the website by using the code of JQuery Ajax because it is useful to save time and ignore extra loading time. If we don't use JQuery Ajax, we need to load our website's page every time. When we use Jquery Ajax on our website, instead of loading the whole page, it will only load the data.

In order to perform Ajax pagination, we have to follow some steps. So firstly, we have to create a table named "Post". After that, we will use that table to add some dummy records. Then we will use Ajax pagination and show all the data. The step to do this is described as follows:

Step 1:

In this step, we are going to Create Posts Table. We will firstly create a table named "posts", and after that, we will add some dummy records into the table, which is described as follows:

Step 2:

In this step, we are going to Make a Database Configuration. For this, we will add some information about the database, such as database name, username, and password, which is described as follows:

application/config/database.php

Step 3:

In this step, we are going to Create Post Controller. This controller will be created with loadRecord() and index(). We will get the ajax data by using the loadRecord(). The view is returned by the index method. Now we will use the controller folder and create a new method into it like this:

application/controllers/Post.php

Step 4:

In this step, we are going to Create View File. We will use our views folder and create "post_view.php" file as a new view file. We will add the below code into that file:

application/views/post_view.php

Now our above code is ready, and we can run it. When we run this, the following output will be generated:

PHP Codeigniter 3 Ajax Pagination using Jquery




Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA