} else if (this.useSessions) {
var context = this;
var request = new pzHttpRequest(this.pz2String, this.errorHandler);
- request.get(
+ request.postParams(
{ "command": "init" },
function(data) {
if ( data.getElementsByTagName("status")[0]
);
var context = this;
var request = new pzHttpRequest(this.pz2String, this.errorHandler);
- request.get(
+ request.postParams(
{ "command": "ping", "session": this.sessionID },
function(data) {
if ( data.getElementsByTagName("status")[0]
var context = this;
var request = new pzHttpRequest(this.pz2String, this.errorHandler);
- request.get(
+ request.postParams(
searchParams,
function(data) {
if ( data.getElementsByTagName("status")[0]
var context = this;
var request = new pzHttpRequest(this.pz2String, this.errorHandler);
- request.get(
+ request.postParams(
{ "command": "stat", "session": this.sessionID },
function(data) {
if ( data.getElementsByTagName("stat") ) {
var context = this;
var request = new pzHttpRequest(this.pz2String, this.errorHandler);
- request.get(
+ request.postParams(
{
"command": "show",
"session": this.sessionID,
var context = this;
var request = new pzHttpRequest(this.pz2String, this.errorHandler);
- request.get(
+ request.postParams(
recordParams,
function(data) {
var recordNode;
var context = this;
var request = new pzHttpRequest(this.pz2String, this.errorHandler);
- request.get(
+ request.postParams(
{
"command": "termlist",
"session": this.sessionID,
var context = this;
var request = new pzHttpRequest(this.pz2String, this.errorHandler);
- request.get(
+ request.postParams(
{ "command": "bytarget", "session": this.sessionID },
function(data) {
if ( data.getElementsByTagName("status")[0]
this.url = url;
this.errorHandler = errorHandler || null;
this.async = true;
+ this.requestHeaders = {};
if ( window.XMLHttpRequest ) {
this.request = new XMLHttpRequest();
pzHttpRequest.prototype =
{
+ postParams: function ( params, callback )
+ {
+ this.requestHeaders["Content-Type"]="application/x-www-form-urlencoded";
+ this._send('POST', {}, this.encodeParams(params), callback);
+ },
get: function ( params, callback )
{
var context = this;
this.async = true;
this.request.open( type, this._urlAppendParams(params), this.async );
+ for (var key in this.requestHeaders)
+ this.request.setRequestHeader(key, this.requestHeaders[key]);
this.request.onreadystatechange = function () {
context._handleResponse();
}
_urlAppendParams: function (params)
{
- return this.url + "?" + this.encodeParams(params);
+ var encodedParams = this.encodeParams(params);
+ if (encodedParams)
+ return this.url + "?" + encodedParams;
+ else
+ return this.url;
},
_handleResponse: function ()