I’ve dug the manual and tried extensivelly to drop the extra function(){...} call after the error and success to do it like mootools but to no good luck.
Is there any way i can avoid the extra function in jQuery?
function doFileDelete(ui) {
$.ajax({
error: function() { doFileDeleteAnimation(ui, false) },
success: function() { doFileDeleteAnimation(ui, true) },
url: '/url-to-delete-file'
});
}
Thank you!
If you have no arguments in the function you would like to call, yes, you can just pass the name of the function as your parameter for your callback. However, if you have at least one argument, you must declare the function and pass the necessary data.
Read more in the jQuery documentation regarding callbacks.