Reputation: 2235
I have a function sampleFunction() in my Groovy Controller class which I access using an Ajax call in my gsp as
var result = ${remoteFunction(controller: 'mycontroller', action: 'sampleFunction',
update: 'none',
params:'\'id=\'+id+\'&content=\'+content+\'&modSubj=\'+modSubj')}
How do I return a string from sampleFunction() so that the variable result has the returned value. Please help.
Upvotes: 0
Views: 2943
Reputation: 22914
A Grails Controller action can call render
directly to return some text in the response instead of using a GSP.
def sampleFunction() {
render 'somestring'
}
Upvotes: 5