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,18 +1,38 @@
$(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) {
$('#virtual_machine_cancel_form').trigger('submit');
});
$('#confirm-cancel').on('click', '.btn-ok', function(e) { var hash = window.location.hash;
$('#virtual_machine_cancel_form').trigger('submit'); hash && $('ul.nav a[href="' + hash + '"]').tab('show');
});
var hash = window.location.hash; $('.nav-tabs a').click(function (e) {
hash && $('ul.nav a[href="' + hash + '"]').tab('show'); $(this).tab('show');
var scrollmem = $('body').scrollTop() || $('html').scrollTop();
$('.nav-tabs a').click(function (e) { window.location.hash = this.hash;
$(this).tab('show'); $('html,body').scrollTop(scrollmem);
var scrollmem = $('body').scrollTop() || $('html').scrollTop(); });
window.location.hash = this.hash;
$('html,body').scrollTop(scrollmem);
});
}); });