What is the best practice to pass many server side information to JavaScript?
<p>Let say that I have many Javascript inside pages. At this moment is pretty easy to initialize variable by simply using some Print/Echo statement to initialize JavaScript value.</p>

<pre><code>Example: var x = &lt;?php echo('This is a value');?&gt;
</code></pre>

<p>I first thought that I could pass all variables value by parameter of function BUT it's impossible because we have a lot of values (we have a multilanguage website and all text are from the server (BD)).</p>

<pre><code>Example : initializeValues(&lt;?php echo('Value1,Value2,Value3,Value...');?&gt;);//JS Method that can be external of the page
</code></pre>

<p>More problem come when we want to take off all JavaScript from pages to move everything on <strong>external</strong> JavaScript file. What would be the good way to initialize all those variables? If I bind the JavaScript methods by using OnLoad of the document I won't be able to use Print/Echo method to populate all values.</p>

<p>Any good pattern to resolve this task?</p>
