first the easy thing:

Is there a way to let the fadeOut be finished before continuing?
Yes, fadeOut accept a callback function that is called after the effect end, take a look here:

http://docs.jquery.com/Effects/fadeOut#speedcallback

A question, what placeInDOM contains? is an id? the html you're replacing
contains the id?

div#contact_form
it is a string? the markup you've pasted shows a form that has an id "contact_form", not a div, maybe the problem is here?

I solved my problem. I know use:
        $(placeInDOM).replaceWith(header + fields + footer);
        $('.submit_' + formID).click(function() {
          form = $('#' + formID);
          form.fadeOut('normal');
          jQuery.post(cgiURL,
            form.serialize(),
            function(xml) {
              alert($(xml).find('status').text());
              form.fadeIn('normal');
            },
            "xml"
          );
          return false;
        });

This does what it should do. The only 'problem' is that the whole DOM
is traversed instead of only placeInDOM. If someone knows how to
optimize this ...
if you solve your first problem you don't need to do this, only for aknowledgment you can use your selector also in this way:

$form = $('#' + formID);
$('.submit_' + formID, $form).click(function() {

$form is the context in which jquery looks for the element with class '.submit_' + formID, but if I haven't 
misunderstood, if you change "placeInDOM" from "div#contact_form" to 
"#contact_form" you solve your problem and you can use the first version of the code you've posted 
before.

Bye



--
gianiaz.net - web solutions
via piedo, 58 - 23020 tresivio (so) - italy
+39 347 7196482

Reply via email to