[SCRIPT]-UNABLE TO ACCESS CODEIGNITER METHODS INSIDE JQUERY LOADED PHP

UNABLE TO ACCESS CODEIGNITER METHODS INSIDE JQUERY LOADED PHP

like my comment, put your inner.php logic inside a code igniter controller, and have the controller echo out your view file, right now you’re just hitting a page called your_domain.com/inner.php, not a view file called inner.php

so instead of:

function loadCallback(a) 
{
  $('#div').load("/inner.php", {json: JSON.stringify(a)});
}

do something like:

function loadCallback(a) 
{
  $('#div').load("/controller/ajax_method", {json: JSON.stringify(a)});
}

and then inside your controller:

function ajax_method(){
    //some logic....
    $this->load->view('inner', $data);
}

you might need to json_encode the view in your ajax_method function since you seem to want to do that, in which case sometihng like:

function ajax_method(){
    //some logic
    $json['json'] = $this->load->view('inner', $data, true)
    echo json_encode($json);
}
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments