tags:

views:

32

answers:

1

Dear all, How i load a new page in my particular div using ajax in codeignator framework? I write the function its work for plane php. example:

href="abc1.php" onclick="makerequest('abc1.php','div_name');return false;"> Page 1

href="abc2.php" onclick="makerequest('abc2.php','div_name');return false;"> Page 2

Note:ajax makerequest function is working properly.

My problem is: how i pass my view file in replace of abc1.php/abc2.php in codeIgantor framework.those files are located on my base_url/view/ i try to retrive the file name using controller but not works.

see my code below:

..........................link.............
 href="<?=base_url()?>main_controller/newPage1.html" onclick="makerequest('<?=base_url()?>main_controller/newPage1.html','upper_middle');return false;">abc1 

href="<?=base_url()?>main_controller/newPage2.html" onclick="makerequest('<?=base_url()?>main_controller/newPage2.html','upper_middle');return false;">abc2 
.................................
...........controller code...

function newPage1()
{
  return $this->load->view('abc1.php');

}
..................But it's not work....

CAN ANYBODY PLS HELP ME???? How i do that ??or any other way to do it easily??

Thanks Riad

A: 

You could use codeignator with JQuery. Using JQuery, you load a url into an element, which could be a div as follows $('#element_id').load(url).

Note that you can replace #element_id with any valid css selector, or even use XPath.

partoa