簡體   English   中英

使用jQuery修改來自XML請求的數據

[英]Modify data from XML Request with jquery

我嘗試從網站的RSS獲取數據。 但是我有一些錯誤

對不起,我的英語不好

我的代碼:

$.ajax({
type: "GET",
url: "https://tuhoc247.com/feed/",
dataType: "xml",
success: function (xml) {
  $(xml).find('item').each(function () {
    console.log("title      : " + $(this).find("title").text());
    console.log("link       : " + $(this).find("link").text());
    var $html = $(this).find('content\\:encoded').html()
    console.log($html.find('ul').text());
  });
},
error: function () {
  alert("An error occurred.");
}
});

但是錯誤:“ $ html.find不起作用”

感謝幫助!

變更:

console.log($html.find('ul').text());

至 :

console.log($($html).find('ul').text());

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM