In the future please post to the new group prototype-scriptaculous:

Change to onComplete: tidyup    (not tidyup() which calls a function and
evaluates to its return value)


On Thu, Jul 10, 2008 at 7:30 PM, Martin Taylor <[EMAIL PROTECTED]> wrote:

> Here's my situation. Parent browser window opens a popup window. The
> popup window contains a form that I'd like to submit to a php script
> via ajax. I'd then like the popup window to automatically close (don't
> need to display any feedback from the php script).
> My popup window calls submitform() when the form is submitted. Here's
> the contents of my .js file:
>     function ajaxUpdater(id,url) {
>           new Ajax.Updater(id,url,{asynchronous:true});
>     }
>     function submitform() {
>         ajaxUpdater('mydiv', 'submit.php?value=' +
>                document.getElementById('something').value
>           , {
>                  onComplete: tidyup()
>             }
>            );
>      }
>     function tidyup() {
>          window.close();
>     }
> Before I added the onComplete callback, this was working - in that the
> data was submitted to the form. Now though, it seems that window.close
> is called before the ajax request is made: watching my server's access
> log I don't see submit.php being called. If I comment out
> window.close() , I see submit.php being called.
> Am I misunderstanding the use of callbacks? I was under the impression
> that onComplete would only be fired once the the webserver had
> returned a status header in response to the ajax request.
> Thanks,
> Martin
> >

Science answers questions; philosophy questions answers.

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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at

Reply via email to