Load rendered mustache template with JS via ajax -> Javascript isn't included anymore.

Re: Load rendered mustache template with JS via ajax -> Javascript isn't included anymore.

by Andreas Grabs -
Number of replies: 0
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Translators

Hi Georg,

did you read the chapter after the chapter my link was pointing to?
https://docs.moodle.org/dev/Templates#Template_requires_JavaScript
There is a description how to execute the js after rendering the template.

templates.runTemplateJS(javascript);

This requires the js in the {{#js}}...{{/js}} section of the template.

Best regards
Andreas