Attempt to catch issue with parsing JSON.
authorDennis Schafroth <dennis@indexdata.com>
Fri, 25 Jun 2010 08:52:36 +0000 (10:52 +0200)
committerDennis Schafroth <dennis@indexdata.com>
Fri, 25 Jun 2010 08:52:36 +0000 (10:52 +0200)
js/pz2.js

index a78417e..bae191d 100644 (file)
--- a/js/pz2.js
+++ b/js/pz2.js
@@ -809,8 +809,13 @@ pzHttpRequest.prototype =
                var json = null; 
                if (this.JSON == null)
                    json = eval("(" + this.request.responseText + ")");
-               else 
-                   json = JSON.parse(this.request.responseText, null);
+               else { 
+                   try {
+                       json = JSON.parse(this.request.responseText, null);
+                   }
+                   catch (e) {
+                           json = eval("(" + this.request.responseText + ")");
+                   }
                this.callback(json, "json");
               } else {
                 var err = new Error("XML response is empty but no error " +