Reputation: 3413
I am having difficulty calling a function after a jQuery AJAX call has finished loading
function to_be_executed_last {
alert("The Call Is Complete");
//some other stuff
}
$("a.jaxable_link").click(function(){
$.post($(this).attr('href'), function(data) {
$('#container').html(data);
//Execute the function to_be_executed_last here AFTER data has finished loading
})
})
How can I do this? Thanks
Upvotes: 0
Views: 219
Reputation: 318738
Simply call your function. The success callback of all jQuery ajax functions is invoked when the response has been received.
Upvotes: 0
Reputation: 630607
You just need to fix the signature (missing parenthesis) and call it, like this:
function to_be_executed_last() {
alert("The Call Is Complete");
//some other stuff
}
$("a.jaxable_link").click(function(){
$.post($(this).attr('href'), function(data) {
$('#container').html(data);
to_be_executed_last();
});
});
Upvotes: 1