Grails AJAX Tags
Grails has a few of these tags that I'm highly skeptical about.
<g:remoteLink action="show" id="1" update="success" onLoading="showProgress();">
Show Book 1
</g:remoteLink>
This gives me this garbage on the page:
<a href="/show/1" onclick="new Ajax.Updater('success','/show/1',{asynchronous:true,evalScripts:true,onLoading:function(e){showProgress();}});return false;">Show Book 1</a>
What is t开发者_Go百科he consensus on using these?
I am not too fond of these tags myself, but they have the advantage of making your GSP pages independent from your ajax implemetation.
I am not sure though why you call this garbage. It is an implementation of an ajax update using prototype. If you do not like the syntax, you can change the ajax library used by the grails tag by adding the following tag to your page (or global layout)
<g:javascript library="yui" />
for Yahoo UI
or
<g:javascript library="dojo" />
for dojo
The resulting javascript will look different, but it will still result in a line of javascript being outputted to your page to support your ajax call.
If you do not like it, you can do like me and write it yourself instead of using the grails tags. I have so much javascript to write anyways that using these tags is kind of useless.
I personally find JQuery to be the easiest library to work with for page interaction and ajax. But this is my personnal taste.
Regards,
Vincent Giguère
精彩评论