694175b63a08b2220b7ba4d60fb5fc66486a72b6 larrym Thu Mar 22 14:37:22 2012 -0700 use request.responseText when available in the errorHandler diff --git src/hg/js/ajax.js src/hg/js/ajax.js index fb489ac..9a0d868 100644 --- src/hg/js/ajax.js +++ src/hg/js/ajax.js @@ -240,35 +240,42 @@ } function setCartVarAndRefresh(name,val) { setCartVar(name,val); var main=$('form[name="mainForm"]') $(main).attr('action',window.location.href); setTimeout("submitMain()",50); // Delay in submit helps ensure that cart var has gotten there first. return false; } function errorHandler(request, textStatus) { var str; + var tryAgain = true; if(textStatus && textStatus.length && textStatus != "error") { str = "Encountered network error : '" + textStatus + "'."; } else { + if(request.responseText) { + tryAgain = false; + str = "Encountered error: '" + request.responseText + "'"; + } else { str = "Encountered a network error." } + } + if(tryAgain) str += " Please try again. If the problem persists, please check your network connection."; warn(str); jQuery('body').css('cursor', ''); if(this.disabledEle) { this.disabledEle.removeAttr('disabled'); } if(this.loadingId) { hideLoadingImage(this.loadingId); } } function catchErrorOrDispatch(obj, textStatus) { // generic ajax success handler (handles fact that success is not always success). if(textStatus == 'success')