使用ajax/jquery解析wordpress RSS提要
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用ajax/jquery解析wordpress RSS提要相关的知识,希望对你有一定的参考价值。
* Set your local path to the wordpress install, in my case was: "/blog/feed"* Edit the var contain = make it set to the selector, in my case I'm populated a list tag <ul></ul>.
* Edit the var limit = 5; Set the amount of blog posts you want to display.
$.ajax({ type: "GET", url: "/blog/feed", dataType: "xml", success: function(xml) { var contain = $("div.panel ul"); var limit = 5; $(xml).find('item').each(function(index){ if( index < limit ){ var title = $(this).find('title').text(); var url = $(this).find('link').text(); var pubDate = $(this).find('pubDate').text(); return; } });//end each } });
以上是关于使用ajax/jquery解析wordpress RSS提要的主要内容,如果未能解决你的问题,请参考以下文章
尝试在页面滚动上加载帖子时出现 Ajax/Jquery/PHP 问题
jQuery 源码解析 异步队列模块 Callbacks 回调函数详解