Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在javascript或jQuery中读取rss xml提要_Jquery_Ajax_Xml_Rss_Jsonp - Fatal编程技术网

如何在javascript或jQuery中读取rss xml提要

如何在javascript或jQuery中读取rss xml提要,jquery,ajax,xml,rss,jsonp,Jquery,Ajax,Xml,Rss,Jsonp,我需要使用jQuery或javascript从第三方获取提要。 我在jQuery中有这段代码来读取jQuery中的rss xml提要 $.ajax({ type: "GET", url:'https://www.thirdpartysite.com/feed.xml', dataType: "jsonp", jsonp: false, jsonpCallback: 'getFeed', headers: { "Access-Control-All

我需要使用jQuery或javascript从第三方获取提要。 我在jQuery中有这段代码来读取jQuery中的rss xml提要

$.ajax({
    type: "GET",
    url:'https://www.thirdpartysite.com/feed.xml', 
    dataType: "jsonp",
    jsonp: false,
    jsonpCallback: 'getFeed',
    headers: { "Access-Control-Allow-Origin":"*",},                

    success: function(xml) {
    console.log("success");
    console.log(xml);
    }   
});
function getFeed(val){
    console.log(val);
}

这是给我的“Uncaught SyntaxError:Unexpected token你可以这样做

var xml = "<rss version='2.0'><channel><title>RSS Title</title></channel></rss>", xmlDoc = $.parseXML( xml ), $xml = $( xmlDoc ), $title = $xml.find( "title" ); var xml=“<rss version='2.0'><channel><title>RSS Title</Title></channel></rss>”, xmlDoc=$.parseXML(xml), $xml=$(xmlDoc), $title=$xml.find(“title”);
你可以这样做

var xml = "<rss version='2.0'><channel><title>RSS Title</title></channel></rss>", xmlDoc = $.parseXML( xml ), $xml = $( xmlDoc ), $title = $xml.find( "title" ); var xml=“<rss version='2.0'><channel><title>RSS Title</Title></channel></rss>”, xmlDoc=$.parseXML(xml), $xml=$(xmlDoc), $title=$xml.find(“title”); 这建议搜索另一种方式来提出你的请求(由于CORS政策)。你也可以用这些关键字进行谷歌搜索(如果你还没有这样做的话):
Uncaught SyntaxError:uncontracted token<+xml
。如果响应可以作为字符串返回并转换为xml或json,那就太好了,使用…这建议搜索另一种方式来提出请求(由于CORS策略)。您还可以使用这些关键字进行谷歌搜索(如果您还没有进行搜索):
未捕获的语法错误:意外的标记<+xml
。如果响应可以作为字符串返回并使用。。。 var xml = "<rss version='2.0'><channel><title>RSS Title</title></channel></rss>", xmlDoc = $.parseXML( xml ), $xml = $( xmlDoc ), $title = $xml.find( "title" );