Hi people! I am using prototype /scriptacolous and have the user send a fair amount of ajax requests to the server. The cronological order of some of the requests are important: 1. Req A tries to store a structure in the DB 2. Req B tries to add an item to the new structure and simply assumes the REQ A was successful and completed. My question: Does anyone know if there is a graceful/clever way of cueing requests like these in prototype? thanks a million, in advance Pelle --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Put Req B in a function and pass the function to the OnComplete parameter in Req A. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Ken Snyder
2008-May-19 19:59 UTC
Re: Advice on graceful way of queing requests w/ prototype?
Parlin wrote:> Hi people! > I am using prototype /scriptacolous and have the user send a fair > amount of ajax requests to the server. > The cronological order of some of the requests are important: > > 1. Req A tries to store a structure in the DB > 2. Req B tries to add an item to the new structure and simply assumes > the REQ A was successful and completed. > > My question: > Does anyone know if there is a graceful/clever way of cueing requests > like these in prototype? > > thanks a million, in advance > > PelleYou could make a simple generic queue class, but I think you would have more flexibility and clarity if you accomplished this type of operation with a class object. See my idea here: http://pastie.caboo.se/199736. However, what is the situation? Obviously it doesn''t make sense to have two links where clicking on one is pre-requisite to clicking the other. And usually with an A and B functionality you don''t offer the ability to perform B until you hear back from A (e.g. digg.com''s functionality to digg then mark as favorite). And don''t forget to account for hacking... Calling script B on the server should not cause data anomalies. - Ken Snyder --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---