I am using several forms for deleting files, renaming files, uploading files in a filemanagement with this form:
<form class="sfmform" action="" method="post">
.......
</form>
and this is my ajaxForm:
$(".sfmform").livequery(function() { $(this).ajaxForm({
success: function(data) {
status.html(data);
$('.myFiles').load(document.URL + ' .myFiles');
},
/*complete: function(data) {
status.html(data);
$('.myFiles').load(document.URL + ' .myFiles');
},*/
});
});
It doesnt matter if i use success or complete; both work perfect. But i was wondering: which one is correct to use in this case?
complete
will fire regardless of error
or success
success
will only fire if you receive a HTTP 200 (normal) response.
So you could use complete
if you received a 404 or some other code to handle an error or close up operations that you want to happen regardless of success or failure, but in your case you want to use success.