Last HTTP codes handling on client side

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

@ -472,20 +472,21 @@ function initAdmin(){
param: {} param: {}
}) })
}, },
error: function() { error: function(data){
data = responseJSON;
if (data.msg){
$.notify(data.msg, 'error');
}
else{
$.notify(locale.ERROR_OCCURRED, 'error'); $.notify(locale.ERROR_OCCURRED, 'error');
}
}, },
success: function(data){ success: function(data){
if (data.status === 'success'){
roomList = data.rooms; roomList = data.rooms;
matches = Object.keys(roomList).length; matches = Object.keys(roomList).length;
updateRoomList($('#searchRoom').val(), 0, itemPerPage); updateRoomList($('#searchRoom').val(), 0, itemPerPage);
updatePagination(); updatePagination();
} }
else{
$.notify(locale.ERROR_OCCURED, 'error');
}
}
}); });
} }
@ -1554,15 +1555,18 @@ function initVroom(room) {
}) })
}, },
error: function(data) { error: function(data) {
data = data.responseJSON;
if (data.msg){
$.notify(data.msg, 'error');
}
else{
$.notify(locale.ERROR_OCCURRED, 'error'); $.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) {
data = data.responseJSON;
if (data.msg){
$.notify(data.msg, 'error');
}
else{
$.notify(locale.ERROR_OCCURRED, 'error'); $.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