Reputation: 1757
I am trying to list addresses and onChange event I send the address ID and return a list of users.
<g:select name="AddressID" from="${address}" optionKey="id" optionValue="address"
onchange="${ remoteFunction(
action:'testMe',
params:'\'id=\' + this.value' ,
update:'show' )}">
</g:select>
I call this div "show".
<div id="show">
<g:each in="${users}" status="i" var="C">
<h3>${C}</h3>
</g:each>
</div>
However, when I click the item on the list box I get the following error:
description The requested resource (/MyTest/WEB-INF/grails-app/views/test/testMe.jsp) is not available.
My understanding of an update attribute inside a remoteFunction is that it is the name of the div which gets refreshed after the remoteFunction call is compeleted.
Thanks.
Upvotes: 0
Views: 4019
Reputation: 34441
I would reorganize your code a little to get the Ajax working:
Move your div
contents into a partial template, called, say, _remoteResponse.gsp
:
<g:each in="${users}" status="i" var="C">
<h3>${C}</h3>
</g:each>
Modify your controller's testMe
action to render the response to a template, something like:
render (template:'remoteResponse', model:[users:['mike,tim']])
main.gsp
, like:<g:javascript library="prototype" />
Upvotes: 2