是否可以向此循环添加回调?作为让应用程序知道“现在是时候执行此操作..”的一种方式..?
$(xml).find("book").each(function(){
var id = $(this).find("id").text();
var x = $(this).find("x").text();
var y = $(this).find("y").text();
var z = $(this).find("z").text();
hasItem(id, x, y, z, function(flag, id, x, y, z) {
if(!flag) {
//doing something
}
});
});
//add callback to tell me that all rows of xml has been read and hasItem is done reading?