I have some problem here. I use JQuery Ajax to send request to my back end server and it will return some clue to notice if the request successfully proceed or not.
I had try to do it in IE8 and IE7, the Jquery Ajax works well, but when i try it on IE11, it will be error for few times, and then work well after that.
My question is, how to make it run well on IE11 without have to wait few times?
This is my Jquery Ajax script
var value = $("#record"+index).attr('value');
var hiddenAmount = Number ($("#hiddenTotalAmount").val());
var values=value.split('/');
var uncheckedAmount = Number(values[1]);
var realAmount = 0;
var realRecord = Number ($("#totalRecord").val());
var checkedDoc = $("#record"+index).val();
var dataString = "action=validateDocNum&holdDocNum="+checkedDoc;
if($("#record"+index).attr('checked')){
$.ajax({
type: "POST",
url: "executeSp2d.do",
data: dataString+"&act=check",
cache: false,
success : function(msg) {
console.log(msg);
console.log(msg.result);
msg.result=$.trim(msg.result);
if(msg.result=="1"){
/* $("#uncheckRecord").dialog('close'); */
realAmount = hiddenAmount + uncheckedAmount;
realRecord = realRecord + 1;
$("#totalRecord").val(realRecord);
$("#hiddenTotalAmount").val(realAmount);
realAmount = accounting.formatMoney(realAmount, "", 2, ".", ",");
$("#totalAmount").val(realAmount);
}else{
alert('Fail to uncheck records');
$("#record"+index).attr('checked', false);
}
},
error: function() {
alert('Fail to check records');
$("#record"+index).attr('checked', false);
}
});
}else{
$.ajax({
type: "POST",
url: "executeSp2d.do",
data: dataString+"&act=uncheck",
cache: false,
success : function(msg){
console.log(msg);
console.log(msg.result);
msg.result=$.trim(msg.result);
if(msg.result=="1"){
realAmount = hiddenAmount - uncheckedAmount;
realRecord = realRecord - 1;
$("#totalRecord").val(realRecord);
$("#hiddenTotalAmount").val(realAmount);
realAmount = accounting.formatMoney(realAmount, "", 2, ".", ",");
$("#totalAmount").val(realAmount);
}else{
alert('Fail to uncheck records');
$("#record"+index).attr('checked', true);
}
},
error: function() {
alert('Fail to uncheck records');
$("#record"+index).attr('checked', true);
}
});
}