jQuery:Problem in Chaining the events.

Posted by Shyju on Stack Overflow See other posts from Stack Overflow or by Shyju
Published on 2009-06-06T10:36:04Z Indexed on 2010/06/14 0:12 UTC
Read the original article Hit count: 223

Filed under:
|

I have the following javascript function which will load data from a server page to the div This is working fine with the FadeIn/FadeOut effects

function ShowModels(manuId) {

     var div = $("#rightcol");  


    div.fadeOut('slow',function() {          
        div.load("../Lib/handlers/ModelLookup.aspx?mode=bymanu&mid="+manuId,
                         { symbol: $("#txtSymbol" ).val() },
                           function() {
                           $(this).fadeIn();                             

                       });

    });

}

Now i want to Show a Loading Message till the div loads the contents from the server page

I tried this.But its not working.Can any one help me to debug this ? Thanks in advance

function ShowModels(manuId) {

     var div = $("#rightcol"); 
     var strLoadingMsg="<img src='loading.gif'/><h3>Loading...</h3>";
    div.fadeOut('slow',function() {
        div.load(strLoadingMsg,function(){

             div.load("../Lib/handlers/ModelLookup.aspx?mode=bymanu&mid="+manuId,
                         { symbol: $("#txtSymbol" ).val() },
                           function() {
                           $(this).fadeIn();


                       });
         });
    });

}

My ultimate requirement is to FadeOut the current content.Show the Loading message.Show the Data coming from server with a FadeIn effect

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-chaining