php - what is the difference in ajaxForm between success: and complete: -
this question has answer here:
i using several forms deleting files, renaming files, uploading files in filemanagement form:
<form class="sfmform" action="" method="post"> ....... </form>
and 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 use success or complete; both work perfect. wondering: 1 correct use in case?
complete
fire regardless of error
or success
success
fire if receive http 200 (normal) response.
so use complete
if received 404 or other code handle error or close operations want happen regardless of success or failure, in case want use success.
Comments
Post a Comment