我有这个.get()
从 URL 中返回的数据很好,但是当它循环通过并且该 URL 上没有所需的数据时,它不会返回警报,.error();
甚至.fail();
如果它找不到它要查找的内容,它甚至不希望发生动作,什么我做错了吗?
$.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"); });