I have a form on my HTML page which is as follows:
<div class="form-group">
<label>Date:</label>
<input type="date" id="inputId2">
</div>
<div class="form-group">
<label>Machine ID:</label>
<input type="text" id="inputId3">
</div>
<div class="form-group">
<label>Planned Maintenance (Time):</label>
<input type="text" id="inputId4" onkeydown="getInputValue2();">
</div>
With JavaScript:
function getInputValue2() {
// Selecting the input element and get its value
if(event.key === 'Enter') {
let value = document.getElementById("inputId2").value;
document.getElementById('Maintenance_date').innerText = value;
let value2 = document.getElementById("inputId3").value;
document.getElementById('Maintenance_machineId').innerText = value2;
let value3 = document.getElementById("inputId4").value;
document.getElementById('Maintenance_time').innerText = value3;
}
}
And I want to send this inputted value into the AWS DynamoDb table and what are my options to do it? I Currently make use rest api to read the data from same DynamoDb table into my HTML page but How to write it from the same page?
Code I used to read from DB URL:
function g_ajaxer(url_str, params, ok_cb, fail_cb){
$.ajax({
url: url_str,
type: "POST",
data: JSON.stringify(params),
crossDomain: true,
contentType: "application/json",
dataType: "json",
success: ok_cb,
error: fail_cb,
timeout: 6000
});
}
function GetMachineTime(date)
{
let readType = mReadType.getMachineTimes;
var
params = {
"date": date,
"readType": readType,
};
console.log(params);
g_ajaxer(G_API_GATEWAY_URL_STR, params, function(response){
handleGatewayResponse(response, readType);
}, function(error){
handleGatewayError(error);
});
}
How to write it using similar type of approach?