Best Way Of Getting Data In Separate Javascript File?
<p>Let me first describe the situation the best I can.</p>

<p>So I am working in a PHP MVC framework.  Inside the controller of a method I collect and format the data as it needs to be and I send it off to the view.  The view page in turn uses that data but also includes separate javascript script files that also need to access the data the controller is passing to the view.</p>

<p>What is the best way to make sure the data the controller is passing to the view is accessible to the other javascript files?</p>

<p>Right now what I am doing is just creating a bunch of hidden for fields so that in my javascript I can just do:</p>

<pre><code>$('selector').val();
</code></pre>

<p>In order to access the data but I can't help to think that there might be a cleaner way to do this.</p>
