-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
43 lines (38 loc) · 1.38 KB
/
script.js
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
var alertRedInput = '#8C1010';
var defaultInput = 'rgba(10, 180, 180, 1)';
function submitForm() {
var myHeaders = new Headers();
myHeaders.append('Content-Type', 'application/json');
var raw = JSON.stringify({
contractAddress: contractaddress.value,
targetVariable: variablename.value,
key: key.value,
deepKey: deepkey.value,
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow',
};
fetch(url.value + '/queriooor/getVariable', requestOptions)
.then((response) => response.json())
.then((result) => {
console.log(result);
console.log(result['data'][0]['variableName']);
console.log(result.data.variableName);
document.getElementById('fetchedData').innerHTML = `<h3>Result</h3>
<ul class="noBullet" id="fetchedDataList">
<li>
<b> <span class="resultClass" id="variableName"> variableName: ${result['data'][0]['variableName']} </span> </b>
</li>
<li>
<b> <span class="resultClass" id="variableValue"> value: ${result['data'][0]['variableValue']} </span> </b>
</li>
<li>
<b> <span class="resultClass" id="variableType"> type: ${result['data'][0]['variableType']} </span> </b>
</li>
</ul>`;
})
.catch((error) => console.log('error', error));
}