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: "http://localhost/codeigniter_cup_myth_new/index.php/libraryController/loadbookdetails",
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...