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:
c7e2806
)
pzHttpRequest: added synchronous load() methd.
author
Jakub Skoczen
<jakub@indexdata.dk>
Wed, 4 Jul 2007 12:33:51 +0000
(12:33 +0000)
committer
Jakub Skoczen
<jakub@indexdata.dk>
Wed, 4 Jul 2007 12:33:51 +0000
(12:33 +0000)
js/pz2.js
patch
|
blob
|
history
diff --git
a/js/pz2.js
b/js/pz2.js
index
bfec842
..
9626b83
100644
(file)
--- a/
js/pz2.js
+++ b/
js/pz2.js
@@
-1,5
+1,5
@@
/*
/*
-** $Id: pz2.js,v 1.43 2007-07-02 20:55:07 adam Exp $
+** $Id: pz2.js,v 1.44 2007-07-04 12:33:51 jakub Exp $
** pz2.js - pazpar2's javascript client library.
*/
** pz2.js - pazpar2's javascript client library.
*/
@@
-40,13
+40,7
@@
var pz2 = function(paramArray) {
//load stylesheet if required in async mode
if( __myself.stylesheet ) {
var request = new pzHttpRequest( __myself.stylesheet );
//load stylesheet if required in async mode
if( __myself.stylesheet ) {
var request = new pzHttpRequest( __myself.stylesheet );
- request.async = false;
- request.get(
- [],
- function ( doc ) {
- __myself.xslDoc = doc;
- }
- );
+ request.get( {}, function ( doc ) { __myself.xslDoc = doc; } );
}
// at least one callback required
}
// at least one callback required
@@
-558,7
+552,7
@@
pzHttpRequest.prototype =
{
get: function ( params, callback )
{
{
get: function ( params, callback )
{
- this._send( 'GET', params, null, callback );
+ this._send( 'GET', params, '', callback );
},
post: function ( params, data, callback )
},
post: function ( params, data, callback )
@@
-566,12
+560,21
@@
pzHttpRequest.prototype =
this._send( 'POST', params, data, callback );
},
this._send( 'POST', params, data, callback );
},
+ load: function ()
+ {
+ this.async = false;
+ this.request.open( 'GET', this.url, this.async );
+ this.request.send('');
+ if ( this.request.status == 200 )
+ return this.request.responseXML;
+ },
+
_send: function ( type, params, data, callback )
{
this.callback = callback;
var context = this;
_send: function ( type, params, data, callback )
{
this.callback = callback;
var context = this;
+ this.async = true;
this.request.open( type, this._urlAppendParams(params), this.async );
this.request.open( type, this._urlAppendParams(params), this.async );
- //this.request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
this.request.onreadystatechange = function () {
context._handleResponse();
}
this.request.onreadystatechange = function () {
context._handleResponse();
}