General developer forum

Adding JavaScript

 
 
Picture of Kevin Burton
Adding JavaScript
 

I am trying to follow the online documentation but I am running into some problems.

 

From my PHP file I do:

$PAGE->requires->yui_module('moodle-mod_mediasite-search', 'M.mod_mediasite.search.init');

But I get:

Uncaught TypeError: Cannot read property 'search' of undefined

The js file (in mod/mediasite/yui/src/search/js/search.js) looks like:

 

YUI.add('moodle-mod_mediasite-search', function(Y) {
var CSS = {
},
SELECTORS = {
},
NS;

M.mod_mediasite = M.mod_mediasite || {};
NS = M.mod_mediasite.search = {};

NS.baseurl = null;
NS.site = null;

NS.init = function() {

. . . . .

Is it obvious what I am doing wrong?

Thank you.

 
Average of ratings: -