I have this supper weird bug, where this method fails in IE9. What is supper weird is that if the IE [Developer Tools] are open, the method does not fail. I have no idea how just by being open the window changes the execution of the script.
When I exec this script with IE [Developer Tools] open, the function executes as expected. When the IE [Developer Tools] is closed, it executes:
alert("00000000000000000000000000000000000");
alert("4444444444444444444");
And that's it, no other alerts are fired.
I have tried removing the timeout: 20000
and cache: false
, but it did not help.
function postAssets(datapm) {
alert("00000000000000000000000000000000000");
$.ajax({
type: "POST",
url: "Igud.aspx/PostD",
cache: false,
contentType: "application/json; charset=utf-8",
data: '{"postedData":"' + datapm + '"}',
dataType: "json",
timeout: 20000,
tryCount: 0,
retryLimit: 10,
success: function (msg) {
alert("4444444444444444444");
console.log('success postAssets ' + msg.d);
},
complete: function (jqXHR, status) {
alert("44444444444aaaaaaaaaaaaaaaaaaaaaaaaaaaa44444444");
if (status == 'success' || status == 'notmodified') {
alert("aaaaaa");
console.log('complete postAssets' + jqXHR.responseText);
var obj = jQuery.parseJSON(jqXHR.responseText);
alert("bbbb");
// alert(parseInt(obj.d));
// alert(parseInt(obj.d) == 1);
if (parseInt(obj.d) == 1) {
$("#thxbox").html("TEST");
alert("ccc");
if ($("#Q3_3").attr('checked') == 'checked') {
$("#thxboxMd").dialog("option", { height: 470 }); alert("dddd");
$("#thxboxReg").show(); alert("eeee");
$("#thxbox").effect("pulsate", { times: 3 }, 1200); alert("ffff");
}
else {
$("#thxboxReg").hide();
$("#thxboxMd").dialog("option", { height: 180 });
}
$("#thxboxMd").dialog("open");
$("body").off("click", "#sbbtn");
$('body').on('click', '#sbbtn', function () {
$("#thxbox").html("TEST");
if ($("#Q3_3").attr('checked') == 'checked') {
$("#thxboxMd").dialog("option", { height: 470 });
$("#thxboxReg").show();
$("#thxbox").effect("pulsate", { times: 3 }, 1200);
}
else {
$("#thxboxReg").hide();
$("#thxboxMd").dialog("option", { height: 180 });
}
$("#thxboxMd").dialog("open");
});
}
else {
$("#thxbox").html("TEST");
$("#thxboxMd").dialog("open");
$("#thxbox").effect("pulsate", { times: 3 }, 900);
}
}
},
error: function (req, status, error) {
alert("444444444444411111111111111111112222222222222222444444");
this.tryCount++;
if (this.tryCount <= this.retryLimit) {
var offSet = this.tryCount * 1000;
getAssetsRecovery = this;
var retry = function () { $.ajax(getAssetsRecovery); };
setTimeout(retry, offSet);
console.log(arguments);
console.log('error postAssets' + error);
$("#thxbox").html("TEST");
$("#thxboxMd").dialog("open");
$("#thxbox").effect("pulsate", { times: 3 }, 900);
return;
}
console.log('error postAssets');
}
});
}