Welcome Guest, Not a member yet? Register   Sign In
Do I need to separate ajax methods from its main controller?
#6

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.
Reply


Messages In This Thread
RE: Do I need to separate ajax methods from its main controller? - by deltatangodt - 08-13-2018, 02:02 PM



Theme © iAndrew 2016 - Forum software by © MyBB