Hi Ismayil. I tried it, but it seems not working in my case. I also tried according to the official doc: http://learn.elgg.org/en/2.3/guides/javascript.html, but couldn't get it working as well. Below is example of some of my code:
// service/views/default/service/hello_world.js
define(function(require) {
var elgg = require("elgg");
var $ = require("jquery");
$('body').append(elgg.echo('hello_world'));
});
// service/views/default/resources/service/all.php
....
elgg_require_js("service/hello_world");
In Chrome console, I can see the error: `require.js:168 Uncaught Error: Mismatched anonymous define() module: function (require) {`.
Hm. Odd. Should work. The only thought is to try a different module name. Service can be a reserved word somewhere.
Hi everyone I am using the same technique and everything seems to work my javascript function is call but the require form field are not control (the form is submit without form control).
Could someone help me to know what's wrong ?
Best regard
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.