• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Call ajax in Footer.php in CI 3

I want call ajax in admin panel from footer.php.

Please help me on this point......

Thanks in Advance........

So why not explain just what you want to do. that does not tell us much.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

Normal practice is for AJAX to "call" a method on the server, not the other way around.

It's not really clear what you are asking. Are you asking how to load your javascript at the bottom of the page?

assume that u have Controller User and there is method named user_info(){...} that serves your ajax request: 
PHP Code:
class User extends CI_Controller { 

public function __construct() {

    public function user_info(){//serves ajax request
        $user_info $this->user_model->get_user_info();
        //if your want return array:
        $data['user_info'] = $user_info;
        echo json_encode($data); //in your javacript code in your ajax request set dataType: 'json'

        // or if u want to return html data
        $this->load->view('user_info_view'$data);//in your javacript code in your ajax request set dataType: 'html'

        //if u want to return html in your as an array
        $data['user_info_html'] = $this->load->view('user_info_view'$datatrue);
//in your javacript code in your ajax request set dataType: 'json'
        echo json_encode($data);

in your ajax request url: 'http.mysite.com/user/user_info'

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.