$(document).on("click", ".cq-dialog-submit", function (e) {
if (window.location.href.indexOf('/etc/cloudservices/sellsheets-creation') >= 0) {
e.stopPropagation();
e.preventDefault();
varui = $(window).adaptTo("foundation-ui");
var$form = $(this).closest("form.foundation-form");
if (!gAuthor) {
varvalid = validateFields();
if (!valid)
returnfalse;
}
$.ajax({
url: '/bin/service/sellsheets-creation',
type: 'post',
data: $form.serialize(),
success: function (data, textStatus, jQxhr) {
if (data.status) {
console.log(data.path);
window.location.href = "/editor.html" + data.path + ".html";
} else {
console.log(data.error);
ui.alert("Error", data.error, "notice");
}
},
error: function (jqXhr, textStatus, errorThrown) {
console.log(errorThrown);
}
});
}
}(jQuery, jQuery(document), Granite.author));