You have to ensure the js is loaded. In your controller you do something like this, adjusting the filename as appropriate.
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js('front_browse.js', 'gallery' ) );
Here you'd change "browse" to the javascript controller location, and "gallery" to your application key.