javascript - AJAX async true returns undefined or null reference error in IE 11 -
using ajax call async set true causes following function (see below) fail undefined error. because ajax call not getting return value before browser attempts use it. if async set false ajax function works. missing?
function ajaxcmd(cmd) { var txtretval; //alert(cmd); $.ajax({ type: "post", url: "/telligent/rpjquery-functions.asp", data: "cmd=" + cmd, datatype: "html", //async not supported in ie8 or ie9 11082014 cache: false, async: true, success: function(data) { //alert("success"); txtretval = data; }, error: function (request, status, error) { //alert(request.responsetext); txtretval = false; }, failure: function() { //alert("failure"); txtretval = false; } }); //return callback( txtretval ); if (txtretval == "not authenticated") { jqt.goback("#"); location.reload(true); alert(txtretval); return (false); } else { // } return (txtretval);
}
this ajax call fail with: unable property length of undefined or null reference. call work async set false:
var filterstring = ajaxcmd("getfilterstring&intformid="+intformid+"&sf="+sf+"&txtformtype="+txtformtype+"&a="+a+"&s="+s); var filterstringlength = filterstring.length (var x = 1; x <= filterstringlength; x++)
Comments
Post a Comment