Jquery 从本地RSS文件读取RSS提要
我正在努力阅读bbc.com的rss提要。 我成功地阅读了bbc.com上的ess。 但是当我从本地计算机上阅读rss时。。 找不到RSS。。。 我的密码在这里Jquery 从本地RSS文件读取RSS提要,jquery,rss,jscript,Jquery,Rss,Jscript,我正在努力阅读bbc.com的rss提要。 我成功地阅读了bbc.com上的ess。 但是当我从本地计算机上阅读rss时。。 找不到RSS。。。 我的密码在这里 <?xml version="1.0" encoding="utf-8"?> <rss version="2.0"> <channel> <title>Weather</title> <link>local://localhost/ali/WeatherAp
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Weather</title>
<link>local://localhost/ali/WeatherApp/</link>
<description>Weather Update Website</description>
<item>
<title>Entry Title</title>
<link>Link to the entry</link>
<guid>http://example.com/item/123</guid>
<pubDate>Sat, 9 Jan 2010 16:23:41 GMT</pubDate>
<description>[CDATA[ This is the description. ]]</description>
</item>
</channel>
</rss>
天气
local://localhost/ali/WeatherApp/
天气更新网站
参赛作品名称
链接到条目
http://example.com/item/123
2010年1月9日星期六16:23:41 GMT
[CDATA[这是描述。]]
Jquery代码是
<link href="jquerymobile/jquery.mobile-1.3.1.css" rel="stylesheet" type="text/css"/>
<link href="zrssfeed/jquery.zrssfeed.css" rel="stylesheet" type="text/css" />
<script src="jquerymobile/jquery.js" type="text/javascript"></script>
<script src="jquerymobile/jquery.mobile-1.3.1.js" type="text/javascript"></script>
<script src="jquery.zrssfeed.min.js" type="text/javascript"></script>
<script src="zrssfeed/jquery.zrssfeed.min.js" type="text/javascript"></script>
<script type="text/javascript">
var selectVal="";
$(document).ready(function () {
//var conceptName = $('#select_menu :selected').text();
//$('#select_menu').change(function() {
// assign the value to a variable, so you can test to see if it is working
// selectVal = $('#select_menu :selected').val();
//alert(selectVal);
//});
//var conceptName = $("select_menu").filter(":selected").val();
$("#Submit").click(function(){
selectVal = $('#select_menu :selected').val();
if(selectVal=='New York')
{
$('#test').rssfeed('http://demo.sslwireless.com/apk/rss.xml');
}
else if(selectVal=='London')
{
$('#test').rssfeed('http://open.live.bbc.co.uk/weather/feeds/en/2643743/observations.rss');
}
else if(selectVal=='Moscow')
{
$('#test').rssfeed('http://open.live.bbc.co.uk/weather/feeds/en/524901/observations.rss');
}
else if(selectVal=='Tokyo')
{
$('#test').rssfeed('http://open.live.bbc.co.uk/weather/feeds/en/1850147/observations.rss');
}
//alert(selectVal);
});
});
</script>
var selectVal=“”;
$(文档).ready(函数(){
//var conceptName=$('#选择菜单:选定')。text();
//$(“#选择_菜单”)。更改(函数(){
//将该值指定给变量,以便您可以测试它是否工作
//selectVal=$('#选择菜单:已选')。val();
//警报(选择VAL);
//});
//var conceptName=$(“选择菜单”).filter(“:selected”).val();
$(“#提交”)。单击(函数(){
selectVal=$('#选择菜单:已选')。val();
如果(selectVal==‘纽约’)
{
$('#test').rssfeed('http://demo.sslwireless.com/apk/rss.xml');
}
else if(selectVal=='London')
{
$('#test').rssfeed('http://open.live.bbc.co.uk/weather/feeds/en/2643743/observations.rss');
}
否则如果(selectVal=='Moscow')
{
$('#test').rssfeed('http://open.live.bbc.co.uk/weather/feeds/en/524901/observations.rss');
}
else if(selectVal=='Tokyo')
{
$('#test').rssfeed('http://open.live.bbc.co.uk/weather/feeds/en/1850147/observations.rss');
}
//警报(选择VAL);
});
});
有人能帮忙吗???在xml标记之前是否有空白?" ". 这可能会导致错误。在jQuery代码中,只有外部提要。如何为本地计算机设置提要?如果将其设置为仅在计算机硬盘中的位置,则它将不起作用。它必须是指向Web服务器的链接。我也试着这样做,但不起作用。你能提供更多关于发生了什么的信息吗。示例使用chrome浏览器调试它,单击ctrl+shift+j,查看它在控制台中写入的内容,以及网络选项卡中的信息。实际上不需要。它使用谷歌api,所以你不能使用localhost作为url。您需要可从外部访问的完整工作网址。