Added simple error handling case

This commit is contained in:
M.Ravi 2017-09-15 18:32:11 +02:00
parent 67f0e9068d
commit fe12b9e688
2 changed files with 9 additions and 1 deletions

View file

@ -1,6 +1,7 @@
$(document).ready(function () {
var create_vm_form = $('#virtual_machine_create_form');
create_vm_form.submit(function () {
$('#btn-create-vm').prop('disabled', true);
$.ajax({
url: create_vm_form.attr('action'),
type: 'POST',
@ -16,6 +17,13 @@ $(document).ready(function () {
window.location = data.redirect;
})
}
},
error: function (xmlhttprequest, textstatus, message) {
fa_icon = $('.modal-icon > .fa');
fa_icon.attr('class', 'fa fa-error');
$('.modal-header > .close').attr('class', 'close');
$('#createvm-modal-title').text(create_vm_error_message);
$('#btn-create-vm').prop('disabled', false);
}
});
return false;

View file

@ -202,7 +202,7 @@
<script type="text/javascript">
var create_vm_error_message = "Some problem encountered. Please try later.";
window.onload = function () {
var locale_date = moment.utc(document.getElementById("order-created_at").textContent, 'YYYY-MM-DD HH:mm').toDate();
locale_date = moment(locale_date).format("YYYY-MM-DD h:mm:ss a");