Grails Ajax渲染列表操作

RST*_*RST 3 ajax jquery grails grails-2.0

尝试使用ajax 呈现所有联系人(这是一个片段)

因此,单击时,它将列出div更新操作中的联系人.我已经测试了一个基本的日期函数(请参阅注释掉渲染动作控制器),以确保ajax部分可以工作,但确实如此,但处理列表我已经打了一个墙并绕圈子

GSP:

<g:remoteLink controller="event" action="showContacts" update="divContactList">Show Contacts!</g:remoteLink>

<div id="divContactList">Show contacts Here...
    <g:each in="${contactList}" status = "i" var="contact">
       <p>${contact.forname}</p>            
       <p>${contact.email}</p>
    </g:each>
</div>
Run Code Online (Sandbox Code Playgroud)

控制器:

def showContacts = {
    def contactList = Contact.findAllByUser(lookupPerson())
//        render "The time is now ${new Date()}"
    render([contactList: contactList])        
}
Run Code Online (Sandbox Code Playgroud)

总的来说,它没有显示网页中的contactList的任何内容,对此的帮助将不胜感激

Jam*_*eeh 5

_templateName.gsp:

<g:each in="${contactList}" status = "i" var="contact">
       <p>${contact.forname}</p>            
       <p>${contact.email}</p>
    </g:each>
Run Code Online (Sandbox Code Playgroud)

GSP:

<g:remoteLink controller="event" action="showContacts" update="divContactList">Show Contacts!</g:remoteLink>

<div id="divContactList">Show contacts Here...
    <g:render template="layouts/templateName" model="[contactList: contactList]" />
</div>
Run Code Online (Sandbox Code Playgroud)

控制器:

def showContacts = {
    def contactList = Contact.findAllByUser(lookupPerson())
//        render "The time is now ${new Date()}"
    render(template: 'layouts/templateName', model:[contactList: contactList])        
}
Run Code Online (Sandbox Code Playgroud)