From e3dab56e79f3e6d5be87114d2a6132a276a5b657 Mon Sep 17 00:00:00 2001 From: zzz Date: Tue, 27 Mar 2012 20:08:11 +0000 Subject: [PATCH] Delay router down message until two consecutive fails --- apps/routerconsole/jsp/js/ajax.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/routerconsole/jsp/js/ajax.js b/apps/routerconsole/jsp/js/ajax.js index 3743a08b5..c364cbe73 100644 --- a/apps/routerconsole/jsp/js/ajax.js +++ b/apps/routerconsole/jsp/js/ajax.js @@ -1,3 +1,5 @@ +var fails = 0; + function ajax(url, target, refresh) { // native XMLHttpRequest object if (window.XMLHttpRequest) { @@ -21,9 +23,13 @@ function ajaxDone(url, target, refresh) { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { + fails = 0; results = req.responseText; document.getElementById(target).innerHTML = results; //document.getElementsbyClassName("hideifdown").style.display="block"; + } else if (fails == 0) { + // avoid spurious message if cancelled by user action + fails++; } else { document.getElementById(target).innerHTML = failMessage; //document.getElementByClassName("hideifdown").style.display="none";