我想循環通過加載了ajax的文件,但它不會循環,我已經嘗試了幾件事情,但我不能讓它工作。jquery ajax無法循環通過找到的數據
// jQuery的
$.ajax({
url: 'file.html',
type: "GET",
dataType: "html",
success: function(data) {
$(data).find('div').each(function(i){
alert('found')
});
},
error: function(){
alert('oeps...')
}
});
// file.html
<div>
// content goes here
</div>
<div>
// content goes here
</div>
<div>
// content goes here
</div>
...
...
在控制檯中的任何錯誤?如果Starx建議沒有幫助的話,可以使用jsfiddle演示來檢查它。 –
不,我沒有得到任何錯誤,會很好做,比我知道去哪裏;) – user759235