Roundcube Community Forum

 

plugin error

Started by mortezaipo, February 13, 2013, 06:03:11 AM

Previous topic - Next topic

mortezaipo

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

SKaero

Whats in your RoundCube error log?

mortezaipo

#2
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!)

rosali

Try:


rcmail.http_post('plugin.myaction', ''); //note second argument


or


rcmail.http_request('plugin.myaction');
Regards,
Rosali

mortezaipo

Thank you so much! solved!  ;)