CodeIgniter Forums
Loading views vs loading JS files - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Loading views vs loading JS files (/thread-60229.html)



Loading views vs loading JS files - El Forum - 02-09-2014

[eluser]Unknown[/eluser]
Is one superior to the other and if so which? My co-worker says that we need to load JS files rather than views with JS inside them due to browser caching. But when I look at the runtime for loading a view, it looks negligible. I see lots of advantages to loading views and the only rebuttal my coworker could make was browser caching. What's the right answer here?

E.G. which is superior or are they the same?

<script type="text/javascript" src="/path/to/file.js"></script>

OR

$this->load->view("views/path/to/file");

The view version is a php file not a js file. Thanks!!