Roundcube Community Forum

News and Announcements => General Discussion => Topic started by: mortezaipo on February 13, 2013, 06:03:11 AM

Title: plugin error
Post by: mortezaipo on February 13, 2013, 06:03:11 AM
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
Title: Re: plugin error
Post by: SKaero on February 13, 2013, 06:09:34 AM
Whats in your RoundCube error log?
Title: Re: plugin error
Post by: mortezaipo on February 13, 2013, 06:15:37 AM
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!)
Title: Re: plugin error
Post by: rosali on February 13, 2013, 01:43:28 PM
Try:


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


or


rcmail.http_request('plugin.myaction');
Title: Re: plugin error
Post by: mortezaipo on February 18, 2013, 02:55:09 AM
Thank you so much! solved!  ;)