-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.html
65 lines (57 loc) · 2.14 KB
/
update.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE html>
<html>
<head>
<title>JPDB Implementation</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="http://login2explore.com/jpdb/resources/js/0.0.3/jpdb-commons.js"></script>
</head>
<body>
<center>
<h1>Update Data</h1>
</center>
<center>
<input id="car_number" maxlength="50" placeholder="Car Number" name="car_number" type="text" /><br><br>
<p>Enter the new Car Name</p>
<input id="car_name" maxlength="50" placeholder="Car Name" name="car_name" type="text" /><br><br>
<input type="button" value="UPDATE DATA" onclick="updateData();" />
</center>
<p id="show"></p>
<script>
function executeCommand(reqString, dbBaseUrl, apiEndPointUrl) {
var url = dbBaseUrl + apiEndPointUrl;
var jsonObj;
$.post(url, reqString, function(result) {
jsonObj = JSON.parse(result);
}).fail(function(result) {
var dataJsonObj = result.responseText;
jsonObj = JSON.parse(dataJsonObj);
});
return jsonObj;
}
function updateData() {
var token = "";
//API Token hidden for safety
var dbname = "CarDB";
var relationName = "CarData";
var car_number = parseInt(document.getElementById("car_number").value);
var car_name = document.getElementById("car_name").value;
var jsonObj = {
car_name: car_name,
};
var reqString = createUPDATERecordRequest(token, JSON.stringify(jsonObj), dbname, relationName, roll);
alert(reqString);
jQuery.ajaxSetup({
async: false
});
var resultObj = executeCommand(reqString,
"http://api.login2explore.com:5577", "/api/iml");
jQuery.ajaxSetup({
async: true
});
alert(JSON.stringify(resultObj));
}
</script>
</body>
</html>