1
我有這個.get()
返回的數據是從網址罰款,但當它循環通過,並沒有在該網址所需的數據它不會返回警報與.error();
或甚至.fail();
想要發生的行動,如果它找不到它找什麼,我做錯了什麼?jquery .get()似乎失敗,但不能得到一個消息回
$.get('/jsp/landing.jsp?id=FiresContent', function(data){
var DataReturned = $(data).find('#' + topNavliID +' > div').each(function(index){
SkuDetail = "<li id='" + index + "'><article><ul><li class='sku-" + index + "'>" + $(this).find('.sku').text() + "</li>";
SkuDetail = SkuDetail + "<li class='prodName-" + index + "'><h2>" + $(this).find('.prodName').text() + "</h2></li>";
SkuDetail = SkuDetail + "<li class='prodDesc-" + index + "'>" + $(this).find('.prodDesc').text() + "</li>";
SkuDetail = SkuDetail + "<li class='action-" + index + "'><a href='" + $(this).find('.actionLink').text() + "' title='" + $(this).find('.action').text() + "'>" + $(this).find('.action').text() + "</a></li></ul></article></li>";
ThumbNail = "<li class='thumbImage-" + index + "'><img src='/images/CAT110/FireSurrounds/thumbnail_" + $(this).find('.sku').text() + ".jpg' alt='" + $(this).find('.prodNameShort').text() + "' title='" + $(this).find('.prodNameShort').text() + "'>";
ThumbNail = ThumbNail + "<span class='prodNameShort-" + index + "'>" + $(this).find('.prodNameShort').text() + "</span></li>";
$('#largeSlides').css('width','+=1000');
$('#largeSlides').append(SkuDetail);
$('#thumbSlides').append(ThumbNail);
// remove loading image once loaded.
$('.loadingmessage').fadeOut(800, function(){
$(this).remove();
});
});
}).fail(function(){ alert("$.get failed!"); });
//.error(function() { alert("error"); });
http://stackoverflow.com/questions/4062317/jquery-get-error-response-function 這個問題可以幫助你一些。 – 2012-07-05 15:33:59