Grails 1.1 GSP 用Prototype实现Ajax - 远程表单提交

一个HTML form也可以异步被提交通过以下两种方式之一。

第一个,使用 formRemote标签,它和 remoteLink 标签有类似的属性 :<g:formRemote url="[controller:'book',action:'delete']" update="[success:'message',failure:'error']"> <input type="hidden" name="id" value="1" /> <input type="submit" value="Delete Book!" /> </g:formRemote >或者作为选择可以使用submitToRemote来创建一个提交按钮。

它允许一些按钮远程提交而一些不依赖操作 :[code]

<g:submitToRemote action=“delete” update=“[success:‘message’,failure:‘error’]” />

[/code]