in serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-ui/src/main/resources/templates/AppResource/app.js [106:138]
function newLoanRequest() {
const form = $('#newLoanForm');
const ssn = form.find('#txtSSN').val();
const term = form.find('#txtTerm').val();
const amount = form.find('#txtAmount').val();
const processInputJson = {
"workflowdata": {
"SSN": ssn,
"term": parseInt(term),
"amount": parseInt(amount)
}
};
const processInput = JSON.stringify(processInputJson);
showSpinnerDialog("Creating loan request");
$.ajax({
url: "{workflowURL}/loanbroker",
type: "POST",
dataType: "json",
contentType: "application/json; charset=UTF-8",
data: processInput,
success: function (result) {
console.log(JSON.stringify(result));
form.modal('hide');
closeSpinnerDialog();
refreshLoans();
},
error: function (xhr, status, error) {
form.modal('hide');
closeSpinnerDialog();
showError("An error was produced during the serverless workflow instance create attempt, please check that que loanbroker-flow application is running:\n" + xhr.responseText);
}
});
}