javascript - How can I make a jquery $.when statement refire if it fails? -
javascript - How can I make a jquery $.when statement refire if it fails? -
so due kind of server asynchronicity issue, or something.. don't know what, happens every 1 time in while (s_mcir_2 calls own ajax functions cross-domain, other server suppose can unreliable).. anyway, every 1 time in while result returned s_mcir_2 null instead of json object.
when happens, test if null, , if is, have $.when statement refire.. theoretically until receives valid output.
any ideas?
$.when(s_mcir_2(alt, data[l_alt])).then(function(result) { //evaluate "result" });
deferred objects can resolve once.
try using named function calls on fail.
function myfn () { $.when(s_mcir_2(alt, data[l_alt])).then(function(result) { //evaluate "result" if (!result) { settimeout(myfn,125); log("r_mcir_2 has failed"); } else { // success, stuff ... } }); }
javascript jquery ajax
Comments
Post a Comment