How to call a php controller method using jquery?
- by chandru_cp
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...