,sendMail: function() {
MODx.Ajax.request({
url : Taichitcho.config.connectorUrl,
params: {
action: 'mgr/adresse/getList'
},
listeners: {
'success': {
fn: function(r) {
alert(r); //test
}
},
'failure':{
fn: function(r) {
alert(r); //test
}
}
}
});
}This question has been answered by JuTs. See the first response.
What's the return value from the AJAX request?
And given that your success and failure handlers are both the same, how do you know which one is triggering?
Modx.Ajax.request expects a 'success' key value return in json, so you have to return 'success' in the processor. Otherwise the success listener will never fire.
public function outputArray(array $array,$count = false) {
if ($count === false) {
$count = count($array);
}
return '{"success":"1","total":"'.$count.'","results":'.$this->modx->toJSON($array).'}';
}