From: Dennis Schafroth Date: Thu, 24 Jun 2010 14:43:00 +0000 (+0200) Subject: Using native JSON if present X-Git-Tag: v1.4.3~11 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=6dec6061f0670a494291e704743581e62d51f681;p=pazpar2-moved-to-github.git Using native JSON if present --- diff --git a/js/pz2.js b/js/pz2.js index 58cf4a3..a78417e 100644 --- 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);