Hi,

Frankly, again, you're not doing much to help us help you here.  We
can't magically see what you're doing and then tell you what's wrong
with it.

Ryan's right, of course, that the most efficient thing would be to
process the entire list on the server.  Of course, there are reasons
not to do it that way too, such as keeping your user informed about
what's happening, script processing timeouts on the server, etc.

If you want to drive this from the client end, I'd probably recommend
a chained loop, where each request's "success" handler triggers the
next request.  You could also update a progress indicator along the
way.  That way, you only have one outstanding request at a time.
Based on what little you've said, I'm guessing you're ending up with
dozens if not hundreds of outstanding overlapped requests, and
overflowing the capacity of some queue (in the browser, on the server,
etc.) somewhere.

Here's a quick-and-dirty example of a chained loop:

function processList(list) {
    processListEntry($('display'), list, 0);
}

function processListEntry(display, list, index) {
    if (index >= list.length) {
        display.update('Done!  Processed ' + list.length + '
entries.');
    }
    else {
        display.update('Processing entry ' + (index + 1) + ' of ' +
list.length + '...');
        new Ajax.Request("server.php?email=" + list[index], {
            onSuccess:      function() {
                processListEntry(display, list, index + 1);
            },
            onFailure:      function() {
                display.update('Failed at entry ' + (index + 1) +
'.');
            }
        });
    }
}

That example keeps all of its state information in various closures
and parameter lists, which is l33t and c00l but may be a bit memory-
intensive (at the very least, the GC will have to work pretty hard).
But you can quickly write a class that stores all of the context as
instance vars and avoid the closures.

FWIW,
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available

On Mar 11, 3:00 pm, Akshit Soota <a.so...@gmail.com> wrote:
> Okay so I replied once but replying the 2nd time to ask you a code
> suggestion of Prototype JS AJAX. I have an array of emails and then
> give me the code to send the emails via a specific PHP Page !
>
> On Mar 11, 6:57 pm, "T.J. Crowder" <t...@crowdersoftware.com> wrote:
>
> > Hi,
>
> > Fails how?  Which part is failing?  What is the error?  Are you
> > overlapping the requests, or sending them serially?  What have you
> > already looked into?  How have you tried to isolate the problem?  Etc.
> > etc. etc.
> > --
> > T.J. Crowder
> > tj / crowder software / com
> > Independent Software Engineer, consulting services available
>
> > On Mar 11, 1:03 pm, Akshit Soota <a.so...@gmail.com> wrote:
>
> > > I'm trying to send mass number of emails via prototype JS AJAX. it
> > > fails at a certain point for bulk mails. What do I do !! I call a PHP
> > > Page !!
>
> > > Regards,
> > > akshits- Hide quoted text -
>
> > - Show quoted text -
>
>
--~--~---------~--~----~------------~-------~--~----~
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