开发者

Get template rendered from controller without render yet

I want to return my response as JSON with ajax containing more atributtes instead only the template:

Defa开发者_如何学Goult:

render(template:"/templates/question",model:[question: question])

..and want something like:

def template = *get*(template:"/templates/question",model:[question: question])
    render [template:template, isTemplate: true] as JSON

Is that possible? Thanks


Then the solution is:

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 
  }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜