我希望将我的回复作为JSON返回,其中ajax包含更多的atributtes而不是模板:
默认值:
render(template:"/templates/question",model:[question: question])
..并想要类似的东西:
def template = *get*(template:"/templates/question",model:[question: question])
render [template:template, isTemplate: true] as JSON
这可能吗? 感谢
答案 0 :(得分:1)
然后解决方案是:
class MyController {
def test = {
// stored as string ...
def x = g.render(template:"/basecontroller/test",model:[name:"wysmedia.com"]);
render(x); // display the template instead render
}
}