I looked everywhere, tutorial and forums and books and such, but I
can't find help for my case. Everyone explains fadeIn and fadeout
effects but not in conjunction with ajax. I also tried ajaxStart and
ajaxStop but couldn't get them to work.

So here's the deal: I call a js file from a php page. There is a
function that does ajax things and changes the content of a div
accordingly. The function works.

Problem is with this transition:

old content > loading message > new content

because the fadeIn/fadeOut effects I implemented give horrible
results!

That's where I need help!!

Here is the (simplified) content of the js file:

<code>function something(variable, anothervariable) {



        jQuery(document).ready

        (

                function($){


                                $("div.mydiv").fadeOut('slow');

                                $("div.mydiv").html("loading 
message").fadeIn('slow', function ()
{



                                        $.ajax({

                                                        type: "POST",

                                                        url: variable,

                                                        data: anothervariable,

                                                        success: function(html){

                                                                
$("div.mydiv").after(html).remove();

                                                        }

                                        });

                          });



                }

        )

}</code>


with this code, what you get is

old content (disappears abruptly)
loading message (fades in)
loading message (fades out)
loading message (fades in)
loading message (disappears abruptly)
new content (appears abruptly)

..which makes no sense!

What am I doing wrong?
Please help me, I am really stuck.

Thanks!

Reply via email to