[jQuery] How to set up a callback on a function I've made?
Hello people,
How can I force some code to run only when the execution of other
function finish? Look my code:
function loading() {
$("#ajaxContent").slideToggle("normal", function() {
$("#ajaxLoader").toggle();
});
}
$("#searchBar > button").click(function() {
loading();
$.get("ajax/list.php", function(data){
$("#ajaxContent").html(data);
loading();
});
});
In the second block of code I want the $.get to execute only when the
function loading(), that was coded by me, finish to execute. I mean,
when the #ajaxLoader is show up.
How can I do something like that?