你有沒有嘗試過這樣的:
$(document).ready(function(){
$.ajax({
url : 'http://pipes.yahoo.com/pipes/pipe.run?_id=26650603c42f41d78bfb5c5c740747d3&_render=json&_callback=pipeCallback',
dataType : 'jsonp',
complete : function(data) {
//alert(data.responseText);
//console.log(data.value);
},
error: function (xhr, status, error) {
alert(error);
}
});
});
function pipeCallback(d){
data = d;
//console.debug(d);
var arts = d.value.items;
for (var i=0; i<arts.length; i++)
{
var a = document.createElement("a");
a.setAttribute("href", arts[i].link);
a.innerHTML = "<h1>" + arts[i].title + "</h1>"
var dv = document.createElement("div");
dv.innerHTML = arts[i].description;
document.body.appendChild(a);
document.body.appendChild(dv);
}
}
是否只是測試它工作正常 也擺脫的console.log的呼叫,如果開發者工具arenot打開它在IE瀏覽器不會工作。
[jQuery ajax responseText'undefined'](http://stackoverflow.com/questions/5460275/jquery-ajax-responsetext-undefined) – 2012-07-05 14:28:00
的可能重複,如async所述:false是必需的。 – 2012-07-05 14:29:40
這是跨域AJAX嗎?如果是這樣檢查出來http://forum.jquery.com/topic/cross-domain-ajax-and-ie#14737000000729148 – 2012-07-05 14:31:01