Hi . I made a simple plugin , but I have "server error(ok)" in response!
I wanna send a simple request data via ajax , and get simple data back.
my js:
$(document).ready(function(){
$("#add_user").click(function(){
rcmail.addEventListener('plugin.callback',function(){ call_me_function(); });
rcmail.http_post('plugin.myaction');
});
});
function call_me_function(response)
{
alert(response.message);
}
my php:
function init()
{
$this->register_action('plugin.myaction',array($this,'request_handler'));
}
public function request_handler($args)
{
$rcmail = rcmail::get_instance();
$rcmail->output->command('plugin.callback',array('message' => 'done.'));
}
Thanks
Whats in your RoundCube error log?
I had Syntax error about line 28 that refers to : $rcmail->output->command('plugin.callback',array('message' => 'done.'));
but I cleaned errors log , and refreshed page , the log file was empty.
(means that errors weren't depend on this error!)
Try:
rcmail.http_post('plugin.myaction', ''); //note second argument
or
rcmail.http_request('plugin.myaction');
Thank you so much! solved! ;)