呵呵 附上段代码 希望对有相同问题的朋友有所帮助 var setin;
var ck;
var outTime = 0;
function Sends() {
$.ajax({
type: "post",
url: "Login.aspx/GetGroup",
async: false,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
num=result.d;
} });
if (num.lenght < 0) {
alert('未获取到可用设备!')
return;
}
SendPosts(num);
outTime = 0;
setin = setInterval(CkBox, 100);
}
function CkBox() {
outTime++;
ck = CanClass.CKPost(num);
if (ck > 0) {
window.clearInterval(setin);
UpdateStates();
} else {
if (parseInt(outTime) > 1000)
{
window.clearInterval(setin);
alert('超时');
}
}
}
function UpdateStates() {
$.ajax({
type: "post",
url: "Login.aspx/SetPost",
async: false,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
if (result.d > 0) {
CanClass.UpdateScrn("欢迎您", 2);
alert('成功!');
} else {
CanClass.UpdateScrn("失败", 2);
alert('失败!'); } }
});
}
var ck;
var outTime = 0;
function Sends() {
$.ajax({
type: "post",
url: "Login.aspx/GetGroup",
async: false,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
num=result.d;
} });
if (num.lenght < 0) {
alert('未获取到可用设备!')
return;
}
SendPosts(num);
outTime = 0;
setin = setInterval(CkBox, 100);
}
function CkBox() {
outTime++;
ck = CanClass.CKPost(num);
if (ck > 0) {
window.clearInterval(setin);
UpdateStates();
} else {
if (parseInt(outTime) > 1000)
{
window.clearInterval(setin);
alert('超时');
}
}
}
function UpdateStates() {
$.ajax({
type: "post",
url: "Login.aspx/SetPost",
async: false,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
if (result.d > 0) {
CanClass.UpdateScrn("欢迎您", 2);
alert('成功!');
} else {
CanClass.UpdateScrn("失败", 2);
alert('失败!'); } }
});
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货