Get the contents of the feed when the user clicks on the Feed list entry

Source: Internet
Author: User

As you can see in the previous section, the Readfeed () method is invoked each time a user clicks on the feed. So we can call the Getrsscontent () method in the server-side Web service asynchronously in the Readfeed () method, and pass the ID of the current feed past. Of course, you should also display the update prompt panel for the user before an asynchronous call:

function readFeed(id) {
    // 显示更新提示面板。
    showProgressBar(true);

    // 取得提要的内容。
    RssService.GetRssContent(id, onRssContentGot);
  }

The code for the callback method Onrsscontentgot () provided when the Getrsscontent () method is invoked is as follows. It hides the update prompt panel and then constructs the contents of the feed using the contententry[data returned by the Web service and displays it to the content area on the right side of the page:

function onRssContentGot(result) {
    // 隐藏更新提示面板。
    showProgressBar(false);

    // 构造提要内容HTML字符串。
    var contentBuilder = new Sys.StringBuilder();
    for (var index = 0; index < result.length; ++index) {
      contentBuilder.append("       contentBuilder.append(result[index].Link); // Link
      contentBuilder.append("" target="_blank" >");
      contentBuilder.append(result[index].Title); // Title
      contentBuilder.append("</a>       contentBuilder.append(result[index].Content); //Content
      contentBuilder.append("</div>     }

    // 设置到提要内容元素上。
    var content = $get("content");
    content.innerHTML = contentBuilder.toString();
  }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.