CodeIgniter Forums
js code in controller - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: js code in controller (/showthread.php?tid=9039)



js code in controller - El Forum - 06-09-2008

[eluser]spherop[/eluser]
is there anything i should be wary of in including blocks at the bottom of my controllers for js controller logic?


js code in controller - El Forum - 06-09-2008

[eluser]gtech[/eluser]
I assume you are echoing javascript in the controllers?

I tend to write my js in views, however sometimes I cheat and just echo json return data in the controller.

The only thing you should be wary of is maintainability. if you have a large applications with every controller containing blocks of javascript it may become unreadable.