title: PHP for loop not working with jQuery API (Uncaught TypeError)
body: <p>So I have this array full of YouTube Video ID's that I'm trying to load with jQuery. But for some reason it's not fully working, It's giving me this error in the console:</p>
  
  <p><a href="https://i.stack.imgur.com/5OmGc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5OmGc.png" alt="enter image description here"></a></p>
  
  <p><strong>CODE:</strong>
      </p>
      </p>
      </p></p>
  
  <pre><code>&lt;script type='text/javascript'&gt;
  $(document).ready(function() {
      &lt;?php
          $videos = array("VGh5DV0D3wk", "6y_NJg-xoeE", "9Q31J3mkCKY");
  
          for ($i = 0; $i &lt; count($videos); $i++) {
      ?&gt;
          // -----------
          $.get(
            "https://www.googleapis.com/youtube/v3/videos", {
               part: 'snippet',
               key: 'AIzaSyDYwPzLevXauI-kTSVXTLroLyHEONuF9Rw',
                  id: '&lt;?php echo $videos[$i]; ?&gt;',
            },
            function(data) {
               $('#playlist-item-&lt;?php echo $i; ?&gt;').text(data.items[&lt;?php echo $i; ?&gt;].snippet.title);
            });
      &lt;?php
      }
      ?&gt;
  });
  &lt;/script&gt;
  </code></pre>