njlqay njlqay - 2 years ago 90
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?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download