in src/main/resources/assets/script.js [37:89]
function execute() {
if (hasPendingExecuteAjaxCall || !checkFormSendable()) {
return;
}
var request = {
"template": $("#template").val(),
"dataModel": $("#dataModel").val(),
"outputFormat": $("#outputFormat").val(),
"locale": $("#locale").val(),
"timeZone": $("#timeZone").val(),
"tagSyntax": $("#tagSyntax").val(),
"interpolationSyntax": $("#interpolationSyntax").val(),
}
$.ajax({
method: "POST",
url: "/api/execute",
data: JSON.stringify(request),
headers: { "Content-Type":"application/json" },
beforeSend: function (jqXHR, options) {
hasPendingExecuteAjaxCall = true;
$.blockUI({ message: null });
$("#error").hide();
return true;
}
})
.done(function (data) {
if (data.problems && data.problems.length != 0) {
showResult(data.problems[0].message, true);
} else {
showResult(data.result, false);
}
})
.fail(function (data) {
if (data.responseJSON) {
if (typeof data.responseJSON.errorCode != 'undefined') {
showResult(data.responseJSON.errorCode + ": " + data.responseJSON.errorDescription, true);
} else {
showResult("The service has responded with error:\n"
+ "HTTP " + data.status
+ (data.responseJSON.message ? ":\n" + data.responseJSON.message : " (No more details available)"),
true);
}
} else {
showResult("The service was unavailable or had returned an invalid response.", true);
}
})
.always(function (data) {
hasPendingExecuteAjaxCall = false;
$.unblockUI();
});
}