How to call a php controller method using jquery?

Posted by chandru_cp on Stack Overflow See other posts from Stack Overflow or by chandru_cp
Published on 2010-04-05T10:39:14Z Indexed on 2010/04/05 10:43 UTC
Read the original article Hit count: 224

Filed under:
|
|

I am developing a web application and i am integrating jquery in it... Now looking for ajax calls with jquery to my controller function....

jquery.ajax() would be useful i think so... But how to call my controller method....

$.ajax({
        type: "POST",
        url: "",
        data: "",
        contentType: "application/json; charset=utf-8",
        async: false,
        dataType: "json",
        success: function(jsonObj) {

function loadbookdetails()
{
    //Paging 
        $college=$_SESSION['college'];
        $this->load->library('pagination');
        $data['bookdetails'] = $this->librarymodel->selectbook($college);
        //$data['rackOptionData'] = $this->librarymodel->selectrack();
         if(empty($data['bookdetails']))
          {
             $data['comment'] = 'no record found!';
          }

        $this->load->view('bookdetials',$data);
}

I am fetching this records here how to use it with jquery.ajax() function and how to convert $data to json and use it with jquery and iterate with a table...

© Stack Overflow or respective owner

Related posts about php

Related posts about jquery-ajax