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

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -