CI and Ajax |
[eluser]Ajaxian64[/eluser]
Hello, I've some problems with CI and Ajax. I've a controller in which i've 2 methods: function getInfo() { search something in database return the data } function whoiswho() { get some data and transmit them to the view $this->load->view('layouts/splash_layout',$data); } In the view I'm calling, there is a $path = base_url() ; In my Layout, I've an Html block in which I call the view "$this->load->view();" ----- when I make an ajax call to the first method (getInfo) I get the result and everything is fine. I have my data displayed in the layout block BUT when I make an ajax call to the whosiswho method CI tells me that "Fatal error: Call to undefined function base_url() " I guess that perhaps I bypass CI by making this ajax call and it doesn't recognize base_url(). But I'm unable to understand how to make this stuff working. May you help me ?
[eluser]Ajaxian64[/eluser]
I've solved My Problem with : function whoiswho() { $data are computed; if (IS_AJAX) { $this->load->view('home',$data); } else { $this->load->view('layouts/splash_layout',$data); // In the layout I launch the view } } I transmit the view instead of layout Also in my Ajax request I launched the file home.php (the view) by specifying the real path system/application etc ... That's completly wrong. I must specify the http://mywebsite.com/mycontroller/whoiswho to achieve the work. Now it works fine. Hope this description would help someone.
[eluser]macfamous[/eluser]
yeaah that's great solution .. thanks for this .. i've got little bit same problem |
Welcome Guest, Not a member yet? Register Sign In |