Therefore, when you process, for example, success data in jquery, you should check if the return data has such necessary data:
success: function (data) {
if (data.new_rank !== undefined) {
$('._user_rank').html(data.new_rank);
}
}
Or may he fail when he is not?
success: function (data) {
$('._user_rank').html(data.new_rank);
}
in the previous example, you can check if something has changed and there should be fixt due to an error.
Which approach is best?
source
share