You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
769 B
24 lines
769 B
window.onload=function(){
|
|
addForm=document.getElementById("add");
|
|
addForm.style.display="none";
|
|
}
|
|
|
|
|
|
function addStudent(){
|
|
console.log("add student");
|
|
form=document.getElementById("add");
|
|
form.style.display="block";
|
|
}
|
|
|
|
function addData(){
|
|
var name=document.getElementById("addName").value;
|
|
var weight=document.getElementById("addWeight").value;
|
|
var height=document.getElementById("addHeight").value;
|
|
var hairColour=document.getElementById("addHairColour").value;
|
|
var gpa=document.getElementById("addGpa").value;
|
|
var data={name, weight, height, hairColour, gpa};
|
|
var option={method:"POST", body: JSON.stringify(data), headers:{'Content-Type':'application/json'}};
|
|
console.log(option);
|
|
fetch('/student', option);
|
|
|
|
} |