-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
30 lines (30 loc) · 1.16 KB
/
script.js
File metadata and controls
30 lines (30 loc) · 1.16 KB
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
function submitEmailForm(form){
var obj = new XMLHttpRequest();
obj.onreadystatechange = function(){
if(obj.readyState == 4){
if(obj.status == 200){
var x = JSON.parse(obj.responseText);
if(x.message=="True")
{
var al=document.getElementsByClassName("al");
al[0].style.display="grid";
setTimeout(()=>{al[0].style.display="none";},3000);
setTimeout(()=>{location.reload(true)},3000);
}
else
{
alert(x.message);
}
}
else{
alert("XMLHttp Status: "+obj.status+";"+obj.statusText);
}
}
};
obj.open("post",form.action,true);
obj.setRequestHeader("Content-Type","application/json");
obj.send(JSON.stringify({"fname":form.fname.value,"lname":form.lname.value,"regno":form.regno.value,"dept":form.dept.value,
"email": form.email.value,"phn_num":form.phn_num.value,"gen":form.g.value,"month":form.month.value,
"day":form.day.value,"year":form.year.value}));
return false;
}