Last HTTP codes handling on client side

master
Daniel Berteaud 10 years ago
parent ff1cda4d4b
commit 8f3243a075
  1. 44
      public/js/vroom.js

@ -472,19 +472,20 @@ function initAdmin(){
param: {} param: {}
}) })
}, },
error: function() { error: function(data){
$.notify(locale.ERROR_OCCURRED, 'error'); data = responseJSON;
}, if (data.msg){
success: function(data){ $.notify(data.msg, 'error');
if (data.status === 'success'){
roomList = data.rooms;
matches = Object.keys(roomList).length;
updateRoomList($('#searchRoom').val(), 0, itemPerPage);
updatePagination();
} }
else{ else{
$.notify(locale.ERROR_OCCURED, 'error'); $.notify(locale.ERROR_OCCURRED, 'error');
} }
},
success: function(data){
roomList = data.rooms;
matches = Object.keys(roomList).length;
updateRoomList($('#searchRoom').val(), 0, itemPerPage);
updatePagination();
} }
}); });
} }
@ -1554,15 +1555,18 @@ function initVroom(room) {
}) })
}, },
error: function(data) { error: function(data) {
$.notify(locale.ERROR_OCCURRED, 'error'); data = data.responseJSON;
if (data.msg){
$.notify(data.msg, 'error');
}
else{
$.notify(locale.ERROR_OCCURRED, 'error');
}
}, },
success: function(data) { success: function(data) {
if (data.status == 'success' && data.msg){ if (data.msg){
$.notify(data.msg, 'success'); $.notify(data.msg, 'success');
} }
else if (data.msg){
$.notify(data.msg, 'error');
}
} }
}); });
checkMoh(); checkMoh();
@ -2090,10 +2094,16 @@ function initVroom(room) {
}) })
}, },
error: function(data) { error: function(data) {
$.notify(locale.ERROR_OCCURRED, 'error'); data = data.responseJSON;
if (data.msg){
$.notify(data.msg, 'error');
}
else{
$.notify(locale.ERROR_OCCURRED, 'error');
}
}, },
success: function(data) { success: function(data) {
if (data.status === 'success' && data.msg && data.msg != ''){ if (data.msg && data.msg != ''){
$.notify(data.msg, { $.notify(data.msg, {
className: 'info', className: 'info',
autoHide: false autoHide: false

Loading…
Cancel
Save