title: Passing php array data to a js file
body: <p>I've got some data in the following array.</p>
  
  <pre><code>$seats = array();
  while ($statement-&gt;fetch()) {
      $seats[] = $book;
  }
  </code></pre>
  
  <p>Here the result is:</p>
  
  <pre><code>  Array ( [0] =&gt; 10 [1] =&gt; 50 ).
  </code></pre>
  
  <p>How can I pass this data to another JS file as follows?</p>
  
  <pre><code>//Case II: If already booked
  var bookedSeats = [10, 50];
  init(bookedSeats);
  </code></pre>