0
IEでtry
ブロックを追加した後、次のコードは機能しません。Error: Could not complete the operation due to error c00ce56e.
を警告します。IEクローズXhrIo問題
goog.require("goog.dom");
goog.require("goog.net.XhrIo");
goog.require("goog.structs.Map");
goog.require("goog.Uri.QueryData");
var errorMessage = "بروز خطا! بازیابی اخبار در این لحظه امکانپذیر نیست.";
loadPersepolisNews = function() {
var url = 'EsteghlalNews?json=1';
var request = new goog.net.XhrIo();
goog.events.listen(request, "complete", function() {
var container = goog.dom.$("persepolisNewsContainer");
if (container != null && container != undefined) {
if (request.isSuccess()) {
try {
var json = request.getResponseJson();
} catch (e) {
alert(e);
}
for (var i = 0; i < json.length; ++i) {
var news = json[i];
var divNews = goog.dom.createDom('div', {
'class': i % 2 == 0 ? 'news newsEven' : 'news newsOdd'
});
var newsLink = goog.dom.createDom("a", {
'href': news.url,
'target': '_blank',
'class': 'newsLink'
}, news.title);
var newsDate = goog.dom.createDom("span", {
'class': 'newsDate',
'dir': 'ltr'
}, news.persianDate.year + '/' + news.persianDate.month + '/' + news.persianDate.day);
goog.dom.appendChild(divNews, newsLink);
goog.dom.appendChild(divNews, newsDate);
goog.dom.appendChild(container, divNews);
}
} else {
alert(request.getStatusText());
var message = goog.dom.createDom('div', {
'style': 'background-color: red; color: white; padding: 2px'
}, errorMessage);
goog.dom.appendChild(container, message);
console.log(request.getLastErrorCode(), " - message: ", request.getLastError());
}
}
});
request.send(url, "GET");
}