Third Party Contributions > API Based Plugins

Plugin Not loading Javascript

(1/1)

mikbull:
Hi there,

I'm just messing around trying to create a very simple plugin. I have a folder under plugins/ 'addressbook_import/' with a .php and .js file.

I have loaded the plugin in the main.inc.php.

The Source:

addressbook_import.php
========================================
<?php
class addressbook_import extends rcube_plugin
{
        private $test;

        function init()
        {
                $this->include_script('addressbook_import.js');
        }

}
?>

addressbook_import.js
================================================
$(document).ready(function(){
if (window.rcmail) {
alert('hello');
}
}

Currently the .js file isn't included at all. (Not visible in FireBug)

What am I doing wrong?


mikbull:
Problem Solved...

It seems the API validates the js before it attaches the script. I had a syntax error in the .js file. See the section in red.

addressbook_import.js
================================================
$(document).ready(function(){
if (window.rcmail) {
alert('hello');
}
}
);

Navigation

[0] Message Index

Go to full version