Using native JSON if present
authorDennis Schafroth <dennis@indexdata.com>
Thu, 24 Jun 2010 14:43:00 +0000 (16:43 +0200)
committerDennis Schafroth <dennis@indexdata.com>
Thu, 24 Jun 2010 14:43:00 +0000 (16:43 +0200)
js/pz2.js

index 58cf4a3..a78417e 100644 (file)
--- a/js/pz2.js
+++ b/js/pz2.js
@@ -805,8 +805,13 @@ pzHttpRequest.prototype =
                        this.request.responseXML == null) {
               if (this.request.responseText != null) {
                 //assume JSON
-                var json = eval("(" + this.request.responseText + ")");
-                this.callback(json, "json");
+                
+               var json = null; 
+               if (this.JSON == null)
+                   json = eval("(" + this.request.responseText + ")");
+               else 
+                   json = JSON.parse(this.request.responseText, null);
+               this.callback(json, "json");
               } else {
                 var err = new Error("XML response is empty but no error " +
                                     "for " + savedUrlForErrorReporting);