title: Incrementing javascript problem
body: <p>I'm extremely new to javascript so I've no idea if I'm doing this correctly.</p>
  
  <p>I've got some php that is filling a javascript variable array:</p>
  
  <pre><code>&lt;?php
  
  $pages = get_pages(array('child_of' =&gt; $post-&gt;ID, 'sort_column' =&gt; 'menu_order'));
  $data = array();
  foreach($pages as $post){
    setup_postdata($post);
    $fields = get_fields(); 
    $data[] = '&lt;p&gt;'.$fields-&gt;company_name.'&lt;/p&gt;';
  }
  wp_reset_query();
  
  // the js array
  echo 'var marker_data = ["'.implode('","', $data).'"];';
  ?&gt;
  </code></pre>
  
  <p>This then feeds this javascript:</p>
  
  <pre><code>infowindow.setContent(marker_data[i]);
  </code></pre>
  
  <p>The problem is that it's not incrementing. If I change the "i" to "0" or "1" then it works. But obviously I need it to increment through.</p>