0

I have a rss feed project that I am working on Question: I would like to know if there is a way of only displaying 5 result at a time.

Currently it displays over 10

Codepen Example

$(document).ready(function() {
  url = 'http://codepen.io/riwakawebsitedesigns/public/feed/';
  $.ajax({
    type: "GET",
    url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=1000&callback=?&q=' + encodeURIComponent(url),
    dataType: 'json',
    error: function() {
      alert('Unable to load feed, Incorrect path or invalid feed');
    },
    success: function(xml) {
      var postlist = xml.responseData.feed.entries;
      var html = '<ul class="list-unstyled">';
      $.each(postlist, function(idx, data) {
        var title = data.title;

        html += '<li>';
        html += '<h3 class="codepen_feed_title">' + data.title + '</h3>';
        html += '<a href="http://codepen.io/riwakawebsitedesigns/"' + title + '/">';
        html += '<span class="codepen_feed_content">Click Here To View It!</div>';
        html += '</a>';
        html += '</li>';
      });
      html += '</ul>';
      $(".codepen_feed").append(html);
    }
  });
});
2
Contributors
1
Reply
13
Views
1 Year
Discussion Span
Last Post by diafol
0

$.each is ensuring that all postlist items are included. Use a for loop instead.

Mind you - is the num parameter (=1000) in the URL the issue. Will changing it to =5 work?

Edited by diafol

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.