From baaf8bec3538590d44addd8e7d603460851e40d3 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 21 Jul 2009 04:01:33 +0000 Subject: [PATCH] * Fallback to eval() method for JSON loading if the native JSON object (FF 3.5, IE8) does not accept our data. * Silence any harmless errors caught in IE --- webcit/static/summaryview.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/webcit/static/summaryview.js b/webcit/static/summaryview.js index eb9e2ebe1..23be534f2 100644 --- a/webcit/static/summaryview.js +++ b/webcit/static/summaryview.js @@ -106,9 +106,15 @@ new Ajax.Request("roommsgs", { }); } function evalJSON(data) { + var jsonData = null; if (typeof(JSON) === 'object' && typeof(JSON.parse) === 'function') { - return JSON.parse(data); - } else { + try { + jsonData = JSON.parse(data); + } catch (e) { + // ignore + } + } + if (jsonData == null) { return eval('('+data+')'); } } @@ -182,7 +188,7 @@ function resortAndDisplay(sortMode) { var i = x+1; compiled[i] = trTemplate.join(""); } catch (e) { - alert("Exception on row " + x + ":" + e); + WCLog("Exception on row " + x + ":" + e); } } compiled[length+2] = ""; -- 2.30.2