-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdelete.html
85 lines (69 loc) · 2.5 KB
/
delete.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE html>
<html>
<head>
<title>Login2Xplore's JsonPowerDB</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>
<style type="text/css">
body
{
background-color:#D3D3D3;
font-family:verdana;
color: #000;
font-size: 24px;
text-align: center;
}
</style>
</head>
<body>
<center><h1>Delete Your Data</h1></center>
<center>
<input id="recordid" maxlength="50" placeholder="ID number" name="recordid" type="text"/><br><br>
<input type="button" value=" DELETE DATA" onclick="deleteData();"/>
</center>
<script>
function createREMOVERecordRequest(token, dbName, relName, reqId) {
var req = "{\n"
+ "\"token\" : \""
+ token
+ "\","
+ "\"dbName\": \""
+ dbName
+ "\",\n" + "\"cmd\" : \"REMOVE\",\n"
+ "\"rel\" : \""
+ relName
+ "\",\n" + "\"record\":"
+ reqId
+ "\n"
+ "}";
return req;
}
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 deleteData(){
var token = "90935330|-31948798561083333|90934481";
var dbname = "PROJECT";
var relationName = "STD-DATA";
var recordid = parseInt(document.getElementById("recordid").value);
var reqString = createREMOVERecordRequest(token, dbname, relationName, recordid );
alert(reqString);
jQuery.ajaxSetup({async: false});
var resultObj = executeCommand(reqString,
"http://api.login2explore.com:5577", "/api/iml");
jQuery.ajaxSetup({async: true});
alert( "VALUE DELETED"+ JSON.stringify(resultObj));
}
</script>
</body>
</html>