Alright, so I'm a little confused on how to create callbacks in JavaScript and a mix of jQuery.
Here's what I'd like to do:
function saveArtDep(vars, callback) {
$.ajax({
url: 'j_artDepAjax.php',
type: 'POST',
data: vars,
success: function(data) {
// callback to fire when success
}
});
}
The reason I want to do this is to be able to re-use this function and having a different "loading" message for what I need it for. In other words, the scenario would look like this:
$('div#job').html('loading...');
saveArtDep('job_id=3&update_art=true', function(){
$('div#job').html('success!');
});
Any help would be great!