Hello everyone,
I'm new to APE and I've been slowly working through my issues.
The discussion board has been very helpful in my troubles and I'm
hoping to receive some help on my latest issue.
I am recieving an error when I run the client.core.request.send
function. The error I'm receiving is this:
Error: this.xhr.open is not a function
Source File: http://ape-test.local/APE_JSF/Source/mootools-core.js
Line: 1611
Here is the code that contains the calling function:
client.addEvent('ready', function() {
//send getInfo command
client.core.request.send('getInfo');
});
Here is the code located on the APE Server:
Ape.registerCmd('getInfo', true, function(cmd) {
//Get data from MySQL table
sql.query('SELECT * FROM smoke_processes', function(res,
errorNo) {
if (errorNo) {
Ape.log('Request error : ' + errorNo + ' : '+
this.errorString());
return ['101', 'MYSQL_ERROR'];
} else {
//Display to logs data received from mysql
Ape.log('Fetching ' + res.length + ' result(s)');
Ape.log('- Environment : ' + res[0].Environment + '\n-
Version : ' + res[0].Version);
cmd.sendResponse('info', res[0]); //Send first result
to client
}
});
})
And the code from mootools-core.js. The line that is failing is
this.xhr.open(method.toUpperCase(), url, this.options.async);:
send: function(options){
if (!this.check(options)) return this;
this.running = true;
var type = $type(options);
if (type == 'string' || type == 'element') options = {data:
options};
var old = this.options;
options = $extend({data: old.data, url: old.url, method:
old.method}, options);
var data = options.data, url = String(options.url), method =
options.method.toLowerCase();
switch ($type(data)){
case 'element': data =
document.id(data).toQueryString(); break;
case 'object': case 'hash': data =
Hash.toQueryString(data);
}
if (this.options.format){
var format = 'format=' + this.options.format;
data = (data) ? format + '&' + data : format;
}
if (this.options.emulation && !['get',
'post'].contains(method)){
var _method = '_method=' + method;
data = (data) ? _method + '&' + data : _method;
method = 'post';
}
if (this.options.urlEncoded && method == 'post'){
var encoding = (this.options.encoding) ? '; charset=' +
this.options.encoding : '';
this.headers.set('Content-type',
'application/x-www-form-
urlencoded' + encoding);
}
if (this.options.noCache){
var noCache = 'noCache=' + new Date().getTime();
data = (data) ? noCache + '&' + data : noCache;
}
var trimPosition = url.lastIndexOf('/');
if (trimPosition > -1 && (trimPosition = url.indexOf('#')) >
-1) url
= url.substr(0, trimPosition);
if (data && method == 'get'){
url = url + (url.contains('?') ? '&' : '?') + data;
data = null;
}
this.xhr.open(method.toUpperCase(), url, this.options.async);
this.xhr.onreadystatechange = this.onStateChange.bind(this);
this.headers.each(function(value, key){
try {
this.xhr.setRequestHeader(key, value);
} catch (e){
this.fireEvent('exception', [key, value]);
}
}, this);
this.fireEvent('request');
this.xhr.send(data);
if (!this.options.async) this.onStateChange();
return this;
},
--
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/