Hi joe,

I think that what you try to do could not be handle with AJAX.request
().
In fact you'll receive control on a callback in the AJAX.request()
when the response is complete in the browser.

What you could do is a pure HTML solution:
create an iFrame inside your page, and set its location to the request
you made, next treat this request in server and use flush() function
to send a part of the response a

On 9 déc, 22:51, "joe t." <thooke...@gmail.com> wrote:
> Thanks for the response Walter.
>
> i can see where you're going with that, but in those successively
> created "new Ajax.Request" calls, it's generating a new request to the
> server, which runs the server-side routine from the beginning, right?
> In my concept, the first call commands the server to run all three
> steps:
>
> Client Request 1 -->
>   Collect the data (send feedback to client) -->
>   Create the PDF (send feedback to client) -->
>   Attach to an email and send (send final feedback)
> End
>
> Where your structure more resembles:
>
> Client Request 1 -->
>   Collect data (send Feedback 1) -->
>   Client Request 2 -->
>     Create PDF (send Feedback 2) -->
>     Client Request 3 -->
>       Attach and email (send Feedback 3)
> End
>
> Am i correct? If so, that works only to the amount of detail i provide
> nested invocations of Ajax.Request to check/perform one specific
> detail of progress. Keep in mind this is only an example: what if i
> need feedback during the attachment process (attaching 1 of 100
> files)? For one, it would be nasty to nest that many Ajax.Request
> calls, and more importantly, that email object only exists within the
> request that creates and processes it. The second request to attach
> file 2 of 100 isn't working on the same email object (as i understand
> it).
>
> i did find one Q&A similar to this where it was suggested to use
> $_SESSION for the current progress message... The initial Request gets
> the server going on the task, and also creates a second Request that
> repeats (eg, Ajax.PeriodicalUpdater). That one does nothing more than
> check $_SESSION for the latest message (which gets updated by the task
> being performed). That feels slightly better to me, despite the
> potential traffic overhead for longer requests (hence the {decay}
> option, i suppose).
>
> Something for me to chew on, i suppose.
>
> Thanks again,
> -joe t.
>
> On Dec 9, 1:22 pm, Walter Lee Davis <wa...@wdstudio.com> wrote:
>
> > I would do this with chained onSuccess handlers. Each one would  
> > trigger a new request to a different endpoint, carrying some token to  
> > identify the visitor.
>
> > $('button').observe('click',function(evt){
> >         //do your lookup
> >         new Ajax.Request('lookup.php',{
> >                 parameters:{id:'<?=$id?>'},
> >                 onCreate:function(){
> >                         $('message').update('searching...');;
> >                 },
> >                 onSuccess:function(transport){
> >                         //make your pdf
> >                         $('message').update('making PDF...');;
> >                         new Ajax.Request('pdf.php',{
> >                                 parameters:{id:'<?=$id?>'},
> >                                 onCreate:..., //you get the idea
> >                                 onSuccess:...
> >                         });
> >                 }
> >         }};
>
> > });
>
> > Walter
>
> > On Dec 9, 2009, at 11:11 AM, joe t. wrote:
>
> > > i think i've seen examples of this, but can't recall where, and could
> > > use some guidance.
>
> > > Obviously it's easy to handle a 1:1 Request/Response
>
> > > How can i do a true 1:many process? For instance:
> > > Client takes a single action which requires the server to perform 3
> > > tasks:
> > > * Query database
> > > * Generate PDF
> > > * Generate email, attach PDF, and send
>
> > > How can i respond to the client as EACH task is accomplished without
> > > ending the request chain?
> > > "Looking up your data . . ." (time-based dots as delay indicator)
> > > "Creating PDF . . ."
> > > "Email sent" (or failed, as the case may be)
>
> > > Is this done with HTTP 2xx headers? Recursive callbacks? If anyone can
> > > point me in the right direction (which include samples), i'd be
> > > grateful.
>
> > > Thanks.
> > > -joe t.
>
> > > --
>
> > > 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 
> > > athttp://groups.google.com/group/prototype-scriptaculous?hl=en
> > > .

--

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-scriptacul...@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