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

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

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


Thanks in Advance........
Reply

#2
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 )
Reply

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

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

#5
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() {

        parent::__construct();    
    
}
    public function user_info(){//serves ajax request
        $this->load->model('user_model');
        $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'
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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