projects
/
pazpar2-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ac0bcf6
)
Refactored pz2HttpRequest
author
jakub
<jakub@indexdata.dk>
Wed, 21 May 2008 13:23:20 +0000
(15:23 +0200)
committer
jakub
<jakub@indexdata.dk>
Wed, 21 May 2008 13:23:20 +0000
(15:23 +0200)
js/pz2.js
patch
|
blob
|
history
diff --git
a/js/pz2.js
b/js/pz2.js
index
94d83ae
..
bc400b1
100644
(file)
--- a/
js/pz2.js
+++ b/
js/pz2.js
@@
-695,6
+695,7
@@
var pzHttpRequest = function ( url, errorHandler ) {
pzHttpRequest.prototype =
{
pzHttpRequest.prototype =
{
+
get: function ( params, callback )
{
this._send( 'GET', params, '', callback );
get: function ( params, callback )
{
this._send( 'GET', params, '', callback );
@@
-714,6
+715,19
@@
pzHttpRequest.prototype =
return this.request.responseXML;
},
return this.request.responseXML;
},
+ encodeParams: function (params)
+ {
+ var sep = "";
+ var encoded = "";
+ for (var key in params) {
+ if (params[key] != null) {
+ encoded += sep + key + '=' + encodeURIComponent(params[key]);
+ sep = '&';
+ }
+ }
+ return encoded;
+ },
+
_send: function ( type, params, data, callback )
{
this.callback = callback;
_send: function ( type, params, data, callback )
{
this.callback = callback;
@@
-728,17
+742,7
@@
pzHttpRequest.prototype =
_urlAppendParams: function (params)
{
_urlAppendParams: function (params)
{
- var getUrl = this.url;
-
- var sep = '?';
- var el = params;
- for (var key in el) {
- if (el[key] != null) {
- getUrl += sep + key + '=' + encodeURIComponent(el[key]);
- sep = '&';
- }
- }
- return getUrl;
+ return this.url + "?" + this.encodeParams(params);
},
_handleResponse: function ()
},
_handleResponse: function ()