I am just learning jquery and it took me a long time to browse the jQuery api site to create these few lines of code. What I want to do is use ajax to load content from another page and put it in an existing div. currently the code is working, but when I click on the link, all the steps are performed at a time, so it performs the load () function when the div #content slides up ...
What I want to do is each line step by step, so after completing one line of THEN, the next line starts (for example, the #content div slides and then the things inside #content are deleted, but now the #content div becomes empty before how he finishes the slide)
$(document).ready(function(){ $("#nav a").click(function(event){ event.preventDefault(); $("#content").slideUp(); $("#content").empty(); var navlink = $(this).attr("href"); $("#content").load(navlink + " " + "#content"); $("#content").slideDown(); }) });
source share