问题描述:

I can't believe I've spent a day trying to make this work.

This little chunk of code:

 $.ajax({

type: "POST",

url: url,

data: $("#form").serialize(),

cache: false,

success: function(data, status) {

if(data!='Success') {

jQuery('#formupdatearea').html("ERROR: "+data).show();

return false;

}

//THIS WORKS

$('#formupdatearea').html("you've been added!");

//THIS WONT WORK

$('#email-wrap').delay(2500).fadeTo( 'slow', 1 );

//OR THIS

$('#email-wrap').fadeTo('fast', 0, function() {

alert("Finished fading");

});

//OR THIS

setTimeout(function() {

$('#email-wrap').hide();

}, 5000);

//BUT THIS ON IT'S OWN DOES:

$('#email-wrap').hide();

},

error: function() {..... continued

The Ajax and everything else works fine. The script is included in, in the head of the parent HTML doc. And there's just a simple form wrapped in a div with the id email-wrap.

I'm totally stumped why a timer or fade just wont' work there. I've tried every variation I can find and I'm beat.

相关阅读:
Top