njlqay njlqay - 1 month ago 4x
jQuery Question

Load php page into view via jQuery load() in CodeIgniter

I need to refresh div contents with single php pages via jQuery.

Without CodeIgniter it works in jQuery like this:


As I am using CodeIgniter I tried to solve it with setting the base_url but it does not work:

$(".myDIV").load("<?php echo base_url()."application/views/my_page.php"; ?>");

How do I call the include request via jQuery correctly?


In controller My_page_ctrl.php

    public function index(){

In javascript

$(".myDIV").load("<?php echo base_url().'my_page_ctrl'; ?>");

Try this one. This will work fine.