【发布时间】:2011-09-16 07:56:58
【问题描述】:
我的代码在其他浏览器中运行良好,但在 IE8 中我得到“页面错误” - 当我点击它时,它说: “抛出异常但未捕获行:16 字符:15120 代码:0 URI:http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"
我尝试链接到 jquery.js(而不是 jquery.min.js)和 1.5.1/jquery.min.js, 但问题仍然存在。
谁能帮我纠正/改进我的代码,或者指导我去哪里看。谢谢
<script type="text/javascript">
function fbFetch()
{
var token = "<<tag_removed>>&expires_in=0";
//Set Url of JSON data from the facebook graph api. make sure callback is set with a '?' to overcome the cross domain problems with JSON
var url = "https://graph.facebook.com/<<ID_REMOVED>>?&callback=?&access_token=" + token;
//Use jQuery getJSON method to fetch the data from the url and then create our unordered list with the relevant data.
$.getJSON(url, function(json)
{
json.data = json.data.reverse(); // need to reverse it as FB outputs it as earliest last!
var html = "<div class='facebook'>";
//loop through and within data array's retrieve the message variable.
$.each(json.data, function(i, fb)
{
html += "<div class='n' >" + fb.name;
html += "<div class='t'>" + (dateFormat(fb.start_time, "ddd, mmm dS, yyyy")) + " at " + (dateFormat(fb.start_time, "h:MMtt")) + "</div >";
html += "<div class='l'>" + fb.location + "</div >";
html += '<div class="i"><a target="_blank" title="opens in NEW window" href="https://www.facebook.com/pages/<<id_removed>>#!/event.php?eid=' + fb.id + '" >more info...</a></div>';
html += "</div >";
}
);
html += "</div>";
//A little animation once fetched
$('.facebookfeed').animate({opacity: 0}, 500, function(){
$('.facebookfeed').html(html);
});
$('.facebookfeed').animate({opacity: 1}, 500);
});
};
【问题讨论】:
-
您的结束 div 在 div 之后和 > 之前实际上没有空格,对吗?我认为这不是问题,但是...
-
谢谢 - 纠正了他们,但正如你所怀疑的 - 问题仍然存在
标签: javascript jquery json internet-explorer-8 cross-browser