From 10c3439fbb19a8651bfec616372eb51dd4ad74cc Mon Sep 17 00:00:00 2001 From: Jakub Skoczen Date: Fri, 14 Sep 2007 09:46:49 +0000 Subject: [PATCH] Solving bug 1581. --- js/pz2.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/js/pz2.js b/js/pz2.js index 581b77e..1804103 100644 --- a/js/pz2.js +++ b/js/pz2.js @@ -1,5 +1,5 @@ /* -** $Id: pz2.js,v 1.56 2007-09-12 08:57:14 jakub Exp $ +** $Id: pz2.js,v 1.57 2007-09-14 09:46:49 jakub Exp $ ** pz2.js - pazpar2's javascript client library. */ @@ -655,7 +655,7 @@ pzHttpRequest.prototype = var el = params; for (var key in el) { if (el[key] != null) { - getUrl += sep + key + '=' + escape(el[key]); + getUrl += sep + key + '=' + encodeURIComponent(el[key]); sep = '&'; } } @@ -669,11 +669,13 @@ pzHttpRequest.prototype = if ( this.request.responseXML && this.request.responseXML.documentElement.nodeName == 'error' && this.request.responseXML.getElementsByTagName("error").length ) { - var errAddInfo = this.request.responseXML.getElementsByTagName("error")[0].childNodes[0].nodeValue; + var errAddInfo = ''; + if ( this.request.responseXML.getElementsByTagName("error")[0].childNodes.length ) + errAddInfo = ': ' + this.request.responseXML.getElementsByTagName("error")[0].childNodes[0].nodeValue; var errMsg = this.request.responseXML.getElementsByTagName("error")[0].getAttribute("msg"); var errCode = this.request.responseXML.getElementsByTagName("error")[0].getAttribute("code"); - var err = new Error(errMsg + ': ' + errAddInfo); + var err = new Error(errMsg + errAddInfo); err.code = errCode; if (this.errorHandler) { -- 1.7.10.4