[add] Displaying data post save
This commit is contained in:
parent
8185a42331
commit
168a6a352e
@ -111,7 +111,7 @@ if(!isset($_SESSION['userName'])){
|
|||||||
<h4 class="modal-title">An error has occurred</h4>
|
<h4 class="modal-title">An error has occurred</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<p>The server has encountered an internal error, please try again later.</p>
|
<p id="internal-server-error-message"">The server has encountered an internal error, please try again later.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
|
||||||
@ -159,7 +159,7 @@ if(!isset($_SESSION['userName'])){
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="modal_error_otro" class="modal fade" role="dialog">
|
<div id="modal_error_other" class="modal fade" role="dialog">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
|
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
@ -188,7 +188,7 @@ if(!isset($_SESSION['userName'])){
|
|||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
|
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header" id="modal_header_server_response_error">
|
<div class="modal-header" id="modal_header_error">
|
||||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
<h4 class="modal-title">An error has occurred</h4>
|
<h4 class="modal-title">An error has occurred</h4>
|
||||||
</div>
|
</div>
|
||||||
|
@ -29,18 +29,21 @@ function loadEmployeeTypes(){
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
error:function(x,e) {
|
error:function(x,e) {
|
||||||
|
let responseText = $.parseJSON(x["responseText"]);
|
||||||
|
|
||||||
if (x.status==0) {
|
if (x.status==0) {
|
||||||
$('#modal_error_internet').modal('show');
|
$('#modal_error_internet').modal('show');
|
||||||
} else if(x.status==404) {
|
} else if(x.status==404) {
|
||||||
$('#modal_error_404').modal('show');
|
$('#modal_error_404').modal('show');
|
||||||
} else if(x.status==500) {
|
} else if(x.status==500) {
|
||||||
$('#modal_error_500').modal('show');
|
$('#modal_server_response_error').modal('show');
|
||||||
|
document.getElementById('server_response_error').innerHTML = responseText['message'];
|
||||||
} else if(e=='parsererror') {
|
} else if(e=='parsererror') {
|
||||||
$('#modal_error_parsererror').modal('show');
|
$('#modal_error_parsererror').modal('show');
|
||||||
} else if(e=='timeout'){
|
} else if(e=='timeout'){
|
||||||
$('#modal_error_timeout').modal('show');
|
$('#modal_error_timeout').modal('show');
|
||||||
} else {
|
} else {
|
||||||
$('#modal_error_otro').modal('show');
|
$('#modal_error_other').modal('show');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -66,26 +69,25 @@ function saveNewEmployee(){
|
|||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: parameters,
|
data: parameters,
|
||||||
success:function(data){
|
success:function(data){
|
||||||
$(data).each(function(i,v){
|
$('#modal_server_response_success').modal('show');
|
||||||
$('#employeeType').append(
|
document.getElementById('server_response_success').innerHTML = 'The employee ' + data['fullName'] + ' has been created with the code ' + data['employeeCode'];
|
||||||
'<option value="' + v.id + '">'+ v.name + '</option>'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
error:function(x,e) {
|
error:function(x,e) {
|
||||||
console.log(JSON.stringify(x));
|
let responseText = $.parseJSON(x["responseText"]);
|
||||||
|
|
||||||
if (x.status==0) {
|
if (x.status==0) {
|
||||||
$('#modal_error_internet').modal('show');
|
$('#modal_error_internet').modal('show');
|
||||||
} else if(x.status==404) {
|
} else if(x.status==404) {
|
||||||
$('#modal_error_404').modal('show');
|
$('#modal_error_404').modal('show');
|
||||||
} else if(x.status==500) {
|
} else if(x.status==500) {
|
||||||
$('#modal_error_500').modal('show');
|
$('#modal_server_response_error').modal('show');
|
||||||
|
document.getElementById('server_response_error').innerHTML = responseText['message'];
|
||||||
} else if(e=='parsererror') {
|
} else if(e=='parsererror') {
|
||||||
$('#modal_error_parsererror').modal('show');
|
$('#modal_error_parsererror').modal('show');
|
||||||
} else if(e=='timeout'){
|
} else if(e=='timeout'){
|
||||||
$('#modal_error_timeout').modal('show');
|
$('#modal_error_timeout').modal('show');
|
||||||
} else {
|
} else {
|
||||||
$('#modal_error_otro').modal('show');
|
$('#modal_error_other').modal('show');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -29,7 +29,6 @@ function processLogin() {
|
|||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: parameters,
|
data: parameters,
|
||||||
success:function(data){
|
success:function(data){
|
||||||
console.log(JSON.stringify(data));
|
|
||||||
if(data["status"] == "success"){
|
if(data["status"] == "success"){
|
||||||
window.location.replace(baseUrl + '/html/landing.php');
|
window.location.replace(baseUrl + '/html/landing.php');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user