1.

Why Do My Ajax-enabled Widgets Stop Working After Some Minutes?

Answer»

This might be due to the fact that you have enabled identity and the session has timed out and the AJAX-calls from your WIDGET (e.g. loadJSONDoc) encounter a 401 (“Unauthorized”) or 500 (“Internal SERVER Error”) error.

A simple method to handle this WOULD be to wrap the loadJSONDoc call and always add a errback callback function that CATCHES this error:

function ljd_errhandler(result) {
if (result instanceof XMLHttpRequestError &&
(result.number == 401 || result.number == 500) {
/* handle error here, for example simply display an error message */
}
}

function do_loadjsondoc(url, cb_func) {
d = loadJSONDoc(url);
d.addCallbacks(cb_func, ljd_erhandler);
return d;
}

This might be due to the fact that you have enabled identity and the session has timed out and the AJAX-calls from your widget (e.g. loadJSONDoc) encounter a 401 (“Unauthorized”) or 500 (“Internal Server Error”) error.

A simple method to handle this would be to wrap the loadJSONDoc call and always add a errback callback function that catches this error:

function ljd_errhandler(result) {
if (result instanceof XMLHttpRequestError &&
(result.number == 401 || result.number == 500) {
/* handle error here, for example simply display an error message */
}
}

function do_loadjsondoc(url, cb_func) {
d = loadJSONDoc(url);
d.addCallbacks(cb_func, ljd_erhandler);
return d;
}



Discussion

No Comment Found