Grails 1.1 GSP 服务端的Ajax - 数据为中心的Ajax与XML

在服务器端使用XML同样普遍:import grails.converters.* def showBook = { def b = Book.get(params.id) render b as XML }不过,因为涉及到DOM,客户变得更复杂:[code]<g:javascript>
function updateBook(e) {
var xml = e.responseXML
var id = xml.getElementsByTagName(“book”).getAttribute(“id”)
$(“book”+id+"_title")=xml.getElementsByTagName(“title”)[0].textContent
}
<g:javascript>
<g:remoteLink action=“test” update=“foo” onSuccess=“updateBook(e)”>Update
Book</g:remoteLink>
<g:set var=“bookId”>book${book.id}</g:set>

The Stand
[/code]