I added the resources plug-in in a grails 1.3.7 application and everything works fine except javascript that is loaded asynchronously.
So if I have a template that contains a
<r:script>
// javascript here
</r:script>
and load it via ajax the js code does not execute, and I get this error:
It looks like you are missing some calls to the r:layoutResources tag
which makes sense because the page has already been rendered and there is no r:layoutResources to handle the newly added r:script js code.
The only workaround I've found is to add
render r.layoutResources(disposition:"defer")
after the actual render(template:...)
in the controller actions that render content asynchronously.
Is there any other more clear solution?