javascript - AJAX - unexpected token < in JSON doesn't call complete function -
i have ajax call saving record on 1 of pages. on button click, have processing image shown , on complete, image should hidden. but, if chance there error occurring on server side, error saying unexpected token < in json
printed in browser's console , completed method not being called. ajax call :
jquery('body').on('click', "#save, function(e) { jquery("processing").show(); jquery.ajax({ method : "post", url : "useredit/save.do", data: { "userid" : row.id } }) .success(function () { table.ajax.reload(); }) .complete(function () { jquery("processing").hide(); }) .error(function () { jquery("processing").hide(); }); });
this making user feel process taking ever complete. there way hide processing image if ajax call completed errors? in advance
Comments
Post a Comment