title: Loop through WP REST API AJAX Array using jQuery
body: <p>I am trying to loop through a AJAX array that was created from the WP REST API. I have no trouble at all returning the data from the first post in the array:</p>
  
  <pre><code>$( '#button' ).on( 'click', function ( e ) {
              e.preventDefault();
              $.ajax( {
                url: 'http://url.com/wp-json/posts?type=post&amp;filter[posts_per_page]=20',
                success: function ( data ) {
                  var post = data.shift(); // The data is an array of posts. Grab the first one.
  
                      $( '.item .front_feed_title' ).text( post.title );
                      $( '.item .front_feed_content' ).html( post.content );
  
                },
                cache: false
              } );
            } );
  </code></pre>
  
  <p>However, I need to loop through the AJAX array and I am unable to figure out the syntax that works for that. I want to pass <code>data</code> into a <code>.each</code> function This does not work:</p>
  
  <pre><code>$( '#button' ).on( 'click', function ( e ) {
              e.preventDefault();
              $.ajax( {
                url: 'http://url.com/wp-json/posts?type=post&amp;filter[posts_per_page]=20',
                success: function ( data ) {
  
                   $.each([data], function(i, objects) {
  
                       console.log(i.title);
  
                   });
  
                },
                cache: false
              } );
            } );
  </code></pre>
  
  <p>My console says that the object is undefined. Can anyone provide some insight into how I should pass <code>data</code> into a jQuery <code>.each</code> function?</p>