循环执行ajax
var HidArray = new Array();
//把所有的hid放到HidArray
SetSettlement(0);
function SetSettlement(index)
{
if(index < HidArray.length)
{
var id = HidArray[index];
$("#"+id).html("正在执行.........");
$.ajax({
type: "GET",
url: "xxxxx.ashx?id=" + id ,
cache:false,
dataType: "text",
async: false, //设置为同步
success: function(data) {
$("#"+id).html("执行成功.");
SetSettlement(index + 1);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
SetSettlement(index + 1);
$("#"+id).html("执行失败.")
}
});
}
}