我有一個ul
其中包含許多鏈接。當使用jQuery加載這些鏈接時,它會同時渲染它們。我怎樣才能加載它們一個接一個,他試圖如下:JQuery加載函數爲一組鏈接逐一?
JS:
$('#publish').click(function() {
$('#get_links li').
each(function() {
$(this).load('test.php',{'post':$(this).text()});
$(this).html("<i class='icon-spin icon-spinner'></i>Loading");
///NEED TOSLEEP UNTILL $.load finish..
}
);
}
);
我怎麼能睡覺。每個循環,直到.load結束?
可能重複[繼續執行後才。每()完成(http://stackoverflow.com/questions/9043968/continue-execution-只有在完成後) – karthikr 2013-04-07 21:03:07
我認爲這些問題是足夠獨特的 - 你引用的一個並不需要用'$()。load()'。 – jmar777 2013-04-07 21:09:41