ajax循环问题,求高手点拨一下
本帖最后由 u012259656 于 2013-09-26 21:36:39 编辑
for (var i = 0; i < rows.length; i++) {
//短信内容----------------------------------------
var Message = $("#Message").val();
//手机号码----------------------------------------
var Mobile = "";
if (rows[i].JSON_fcontact2mobile.length > 0)
{ Mobile = rows[i].JSON_fmobile + "," + rows[i].JSON_fcontact2mobile }
else
{ Mobile = rows[i].JSON_fmobile }
//公司信息----------------------------------------
var Company = rows[i].JSON_fcompany;
//执行--------------------------------------------
$.post("../ajax/CrossDomain.ashx",
{ Action: 2,
Mobile: Mobile,
Message: Message
},
function (State) {
alert(Mobile + State);
});
}
for (var i = 0; i < rows.length; i++) {
//短信内容----------------------------------------
var Message = $("#Message").val();
//手机号码----------------------------------------
var Mobile = "";
if (rows[i].JSON_fcontact2mobile.length > 0)
{ Mobile = rows[i].JSON_fmobile + "," + rows[i].JSON_fcontact2mobile }
else
{ Mobile = rows[i].JSON_fmobile }
//公司信息----------------------------------------
var Company = rows[i].JSON_fcompany;
//执行--------------------------------------------
$.ajax({
url: "../ajax/CrossDomain.ashx",
type: "post",
async: false,
data:{
Action: 2,
Mobile: Mobile,
Message: Message
},
success: function(msg){
alert(Mobile + State);
}
});
}