In the future please post to the new group prototype-scriptaculous:
http://groups.google.com/group/prototype-scriptaculous?hl=en
Change to onComplete: tidyup (not tidyup() which calls a function and
evaluates to its return value)
-Fred
On Thu, Jul 10, 2008 at 7:30 PM, Martin Taylor
<test-Jp3n8lUXroS9FHfhHBbuYA@public.gmane.org> 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
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---