I’m trying to make an ajax enabled webapp using the tag. For some reason,
it redirects the entire page to my template, and doesn’t update the specified div.
Here is what I have so far:
In the head of my GSP file:
<g:javascript library="jquery" />
<g:setProvider library="jquery"/>
In the body of my GSP file:
<div id="message"></div>
<g:remoteLink controller ="reqOff" action="quick_req" update="[success: 'message']">ar</g:remoteLink>
My controller method returns a template; which seems to be working fine.
The problem:
Right now, rather than update the div, it renders my template on a new page.
Other Notes:
– My grails version is 1.4.0.M1
– My jquery plugin is installed and updated to 1.7.2
– I have no other conflicting JS libraries in my view
I fixed the problem with JQuery and incidentally it was related to the CSS problem mentioned in the comments. As it turns out Gregg was on to something when he pointed out that the jQuery may not be loading in.
What I did is upgrade my resources plugin, and since it brokeing my app, forced me to learn what the resources plugin actually does. After setting up my modules and getting the r:require and r:layoutResources tag in, everything loads in just fine. It took a little trial and error, and I followed a tutorial type blog post from the plugin’s author: http://www.anyware.co.uk/2005/2011/09/12/optimising-your-application-with-grails-resources-plugin/
In conclusion, check to make sure your resources are loading correctly with the resources plugin. I was under the assumption that the g:javascript tag loaded jQuery, but for my app, this apparently was not the case.