load data only when slide down with jquery

Posted by hd on Stack Overflow See other posts from Stack Overflow or by hd
Published on 2011-02-20T06:06:45Z Indexed on 2011/02/20 7:25 UTC
Read the original article Hit count: 155

Filed under:
|
|

I have a link that when user clicks on it some data loaded into a div. I want to display waiting message to user until the data fetch completely from server and then show it to user.

I also want to call the data url happen only when the result box is going down(slide down) not in both of slide down and slide up events to reduce load on server.

my code is here but i don't know how implement second part into it:

$(document).ready(function() {
        $("#prereq").hide();
        $("#prereqlink").click(function() {
             $("#prereq").html("please wait ...");
             $("#prereq").slideToggle("slow");

             $.ajax({ url:"referee.php",
                      success:function(data) {
                              $("#prereq").html(data);
                    }
             });

        });
 });

would you help me??

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about load