X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=js%2Fpz2.js;fp=js%2Fpz2.js;h=a78417e2aa8be6a199375e89122ea20797a255b9;hb=6dec6061f0670a494291e704743581e62d51f681;hp=58cf4a3505960fdfc37aaa6059f1c98f2a6958a0;hpb=d955c1f956d98dff3ad66d7a4a82e6a0af6cca64;p=pazpar2-moved-to-github.git 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);