On Wed, Sep 16, 2009 at 9:56 PM, brian <[email protected]> wrote:
> On Wed, Sep 16, 2009 at 8:17 PM, Marcelo Andrade <[email protected]> wrote:
>> On Wed, Sep 16, 2009 at 7:42 PM, brian <[email protected]> wrote:
>>>
>>> You could pass the information to the controller through the AJAX call.
>>
>> Thanks brian, but how exactly can I do it?
>
> I guess that depends on your AJAX call. I see you're using AjaxHelper,
> though; I've never used it (I use jQuery) so I can't help with that,
> sorry.
Okay. But regardless of the ajax call, what I don't
know is how to make the current index in a loop
available.
My main action is something like this:
function toolongaction() {
// ...
$this->Session->write('TOTAL', TOTAL);
for($i= 0; $i < TOTAL; $i++) { // a long loop
// do a lot of stuff...
$this->Session->write('CURRENT', $i); // what I'm doing now, but
doesn't work
// ...
}
}
function ajaxaction() {
// trying to read the session key above
$cur= $this->Session->read('CURRENT'); // EMPTY... :-(
$tot= $this->Session->read('TOTAL');
$msg= sprintf('Loading... item %s of %s', $cur, $tot);
$this->set('status', $msg);
}
If it's not possible to use the Session, how did you
do to create yours status ajax calls in a situation like
this?
Thanks again.
--
MARCELO DE F. ANDRADE
Belem, PA, Amazonia, Brazil
Linux User #221105
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---