Hi,

Nothing for it but to walk through it with a debugger like Firebug
(using Firefox); don't know if there's anything like that for Safari.

Otherwise, frankly, we're just guessing without more context.  For
instance, in your parameters to the second request you're referencing
the symbols (not strings) to_field, subject_field, and body_field --
do those symbols actually exist at that point?  Have they been filled
in with something relevant, and not cleared before the request is
fired?  Remember that closures (like your success handler) keep a
*reference* to the vars, not their values, so for instance:

function test() {
    var x = "foo";
    new Ajax.Request("somepage", {
        onComplete: function(response) {
            alert(x);
        }
    });
    x = "bar";
}

If you call test(), when the request completes it will alert "bar",
not "foo".

But again, that's a total guess, and apologies for telling you
something you probably already know.

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


On Jul 15, 3:37 am, "Bobby.D" <bobby.d...@gmail.com> wrote:
> I've got this:
>
> var jobs = getChecked();
>                                 jobs = jobs.toJSON();
>                                 new Ajax.Request("ajax.php", {
>                                         parameters: {
>                                                 o: 'service',
>                                                 m: 'getMultiPSEmail',
>                                                 serviceID: jobs
>                                         },
>                                         onSuccess: function(x) {
>                                                 var to_field = x.responseText;
>                                                 
> $('server_email_subject').value;
>                                                 var url = "ajax.php";
>                                                 new Ajax.Request(url, {
>                                                         method: 'post',
>                                                         parameters: {
>                                                                 o: 'servers',
>                                                                 m: 
> 'send_email',
>                                                                 to: to_field,
>                                                                 subject: 
> subject_field,
>                                                                 body: 
> body_field
>                                                         },
>                                                         onSuccess: 
> function(req) {
>                                                                 
> alert(req.responseText);
>                                                                 var response 
> = req.responseText.evalJSON(true);
>                                                                 
> if(response.status == "100") {
>                                                                         
> jQuery("#emailClientModal").dialog('close');
>                                                                         
> message("Email Sent");
>                                                                         
> //jQuery('#messageModal').dialog('open');
>                                                                 }
>                                                                 else {
>                                                                         
> jQuery('#emailClientModal').dialog('close');
>                                                                         
> jQuery('#error_message_modal').data('title.dialog', "Error
> "+response.errornum);
>                                                                         
> $('error_message_body').innerHTML = "Sending of the email
> failed:<br/><br/>"+response.errormessage;
>                                                                         
> jQuery('#error_message_modal').dialog('open');
>                                                                 }
>                                                         },
>                                                         onFailure: 
> function(req) {
>                                                                 
> alert(req.responseText);
>                                                         }
>                                                 });
>                                         }
>                                 });
>
> The 1st Ajax.Request works fine, I get the responseText as
> anticipated. However, the 2nd one doesn't fire and I can't figure out
> why. Safari doesn't show any errors.
>
> I've done this before, any idea why this would break?
--~--~---------~--~----~------------~-------~--~----~
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