Added js handling of create vm form submission

This commit is contained in:
M.Ravi 2017-09-15 17:30:38 +02:00
parent ca5a99ccf5
commit e14ed0c69f

View file

@ -1,7 +1,27 @@
$(document).ready(function () {
var create_vm_form = $('#virtual_machine_create_form');
create_vm_form.submit(function () {
$.ajax({
url: create_vm_form.attr('action'),
type: 'POST',
data: create_vm_form.serialize(),
success: function (data) {
if (data.status === true) {
fa_icon = $('.modal-icon > .fa');
fa_icon.attr('class', 'fa fa-check');
$('.modal-header > .close').attr('class', 'close');
$('#createvm-modal-title').text(data.msg_title);
$('#createvm-modal-body').text(data.msg_body);
$('#createvm-modal').on('hidden.bs.modal', function () {
window.location = data.redirect;
})
}
}
});
return false;
});
$( document ).ready(function() {
$('#confirm-cancel').on('click', '.btn-ok', function(e) {
$('#confirm-cancel').on('click', '.btn-ok', function (e) {
$('#virtual_machine_cancel_form').trigger('submit');
});