How to return a view to an ajax call ? |
Hi,
I recently had to modify some code of my colleague. I saw that we don't handle ajax calls the same way. When it's about returning data, we both use. Code: echo json_encode($this->upload->data()); However, when we have to return a whole view, we are a bit different : He uses : Code: echo $this->load->view('theview',$data); I use : Code: $view = $this->load->view('theview',$data, TRUE); I also saw somewhere online Code: $data = $this->load->view('theview',$data, TRUE); Those techniques seem to work correctly, but what the best pratices say about that ? Is one of them safer, faster or more "MVC friendly" ? Thanks ![]() |
Messages In This Thread |
How to return a view to an ajax call ? - by Tao Pai Pai - 02-25-2015, 01:32 PM
RE: How to return a view to an ajax call ? - by silentium - 02-25-2015, 05:05 PM
RE: How to return a view to an ajax call ? - by Tao Pai Pai - 02-26-2015, 01:01 AM
RE: How to return a view to an ajax call ? - by james - 02-26-2015, 08:31 AM
RE: How to return a view to an ajax call ? - by spjonez - 03-01-2015, 10:55 AM
|