Monday, July 27, 2009

sometimes it's simpler to use plain ajax...

today I was struggling for a bit with generating the update part of a remote function on the fly and after a couple of minutes. I started thinking, do I have to really use this tag? Why don't I use just plain Ajax, since grails will generate the same code anyway.

Solution:


<div class="center">
<img name="${bin.getId()}" src="${createLinkTo(dir: 'images', file: 'remove.gif')}" alt="zoom" onclick="new Ajax.Updater

('bin-container-${db}', '/quality-war/management/remove_bin_ajax', {asynchronous:true,evalScripts:true,parameters


:'bin=${bin.getId()}&database=${db}'});"/>
</div>


this also shows how to submit several parameters at once in plain ajax style.

No comments:

Post a Comment