Do I need to separate ajax methods from its main controller? |
I like to keep my ajax functions in the same controller where they are being called from.
What I did is extend the Controller class (MY_Controller.php) and in there add a function called set_page_type($type), and in that function I can set if this is an ajax page or not. In that case, I have logic to handle Ajax request. Then, in each Controller I make, I extend THAT class and then as the first step in a controller's specific function, set if it is an ajax handler or a regular page. Such as: $this->set_page_type('ajax); and then handle the ajax request. |
Messages In This Thread |
Do I need to separate ajax methods from its main controller? - by kaitenz - 07-16-2018, 12:13 AM
RE: Do I need to separate ajax methods from its main controller? - by Pertti - 07-16-2018, 01:08 AM
RE: Do I need to separate ajax methods from its main controller? - by kaitenz - 07-16-2018, 03:30 AM
RE: Do I need to separate ajax methods from its main controller? - by Pertti - 07-16-2018, 05:12 AM
RE: Do I need to separate ajax methods from its main controller? - by kaitenz - 07-16-2018, 11:12 PM
RE: Do I need to separate ajax methods from its main controller? - by deltatangodt - 08-13-2018, 02:02 PM
RE: Do I need to separate ajax methods from its main controller? - by kaitenz - 08-13-2018, 11:01 PM
|