Hi Dave,

I think that a mix of both is good.
First, observe the icon with javascript. Then when it is clicked (or
whatever), launch an Ajax.Request to the server to update the
database, and set something to say to the user that something is
launch in the background.
When the request is Complete, use Ajax.Request onComplete callback to
modify HTML. Use others callbacks in case of error.

So that, the HTML is set only when the database is modified!

--
david.

On 13 oct, 23:17, Dave L <dly...@gmail.com> wrote:
> I'm not sure what is best practice in this situation.  I have a quiz
> add icon that, when clicked, adds an element to a quiz list.  Right
> now it is using a link_to_remote with an image_tag (in ruby rails) and
> when clicked it hits the server, saves the quiz add/remove toggle and
> then uses rjs to change the icon.
>
> It seems that it would be faster to use straight javascript to observe
> the icon and then when clicked change the icon and create an
> ajax.request to run in the background to save the add/remove toggle to
> the database.  Would this be better?  I know it would seem faster to
> the user, but maybe it is good to make the user wait until the save to
> the database / ajax.request call is completed?  That way it would
> prevent the user from clicking the icon rapidly and creating a number
> of ajax.requests in a row.
>
> Any input is appreciated, Dave
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to