[jQuery] Basic JQuery paging with CodeIgnitor

[jQuery] Basic JQuery paging with CodeIgnitor


Hi there,
I'm wanting to code a very basic pagination service that works with,
or without JavaScript switched on. I do not want to use a plug-in of
any kind to solve this. Primarily, I want to understand what the
$.ajax is supposed to be like when handing $_GET/$_POST variables.
This is what I have and uses CodeIgnitor. This is not a code ignitor
question, it is a Jquery question. I want to know what am I meant to
do in the $.ajax bit because I am utterly confused about it and there
is no clear-cut examples on how to use it.
What I'd really like is an example showing how to integrate JQuery
with PHP/MySQL without using a third-party plugin that handles $_GET/
$_POST requests, like a simple pagination.
[code]
// MySQL Database -- You will need to add some customers first
CREATE TABLE `ci_customers` (
`id` mediumint(8) unsigned NOT NULL auto_increment,
`name` varchar(32) collate latin1_general_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
AUTO_INCREMENT=1 ;
[/code]
[code]
<?php
// PHP controller
if (!defined('BASEPATH')) exit('No direct script access allowed');
class List_customers extends Controller {
    // controller
    function List_customers() {
        parent::Controller();
        $this->output->enable_profiler(TRUE);
    } // end function
    function index() {
        // Load libraries
        $this->load->library('pagination');
        $this->load->library('table');
        $this->load->library('validation');
        // Get the page offset
        $offset = $this->get_page_offset();
        // List all customers with paginated effect
        $this->list_all($offset);
    } // end function
    function list_all($offset=0) {
        // Load customer model
        $this->load->model('Customer_list_model');
        // =======================================================
        // Initialize Pagination
        $config['base_url'] = site_url('list_customers/index/');
        $config['total_rows'] = $this->db->count_all('ci_customers');
        $config['per_page'] = 10;
        $num             = $config['per_page'];
        $config['cur_page']    = $offset;
        $data['offset']         = $offset;
        $this->pagination->initialize($config);        // Run paging
        // =======================================================
        // Get data
        $data['results'] = ( $this->Customer_list_model-























































    • Topic Participants

    • zmt98