-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode.js
36 lines (31 loc) · 1.21 KB
/
code.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
const name = document.getElementById('aiform-name').value;
const email = document.getElementById('aiform-email').value;
if(name == '')
{
alert('Fill your name!');
return false;
}
if(email == '')
{
alert('Fill your email!');
return false;
}
const data = { name: name, email: email };
fetch('https://jsightforms-ce0e.restdb.io/rest/aiform', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-apikey': '63f3ae20478852088da684cf',
},
body: JSON.stringify(data),
})
.then((response) => response.json())
.then((data) => {
console.log('Success:', data);
})
.catch((error) => {
console.error('Error:', error);
return false;
});
document.getElementById('jsightai-form').innerHTML = '<p>Your API improvement request has been submitted. JSight AI will send you the response soon.</p>';
return false;