I’m trying to find a good organization practice of my javascript (jquery) files when using CodeIgniter. I do a lot of ajax sites and many of my views are loaded in various controllers, I’d like to only load the necessary javascript for those views without duplicate code. How do y’all handle this issue?
I’m trying to find a good organization practice of my javascript (jquery) files when
Share
Try using phil sturgeon’s template library
add a method called add_js and have it put itself as a variable just before build. Call this add_js method in each controller (in each method if needed) and define the js you want to be included.
then in your view do