Project_Fish/static/script.js
2021-11-10 22:00:18 +01:00

78 lines
2.1 KiB
JavaScript

function GetServices(){
$.ajax({
type: "POST",
url: "/GetServices",
data: JSON.stringify({
"nummer": document.getElementById('nummer_input').value,
}),
contentType: "application/json",
dataType: 'text json',
success: function(response) {
document.getElementById('resultblock').innerHTML = response
},
error: function(error){
console.log(error);
}
});
}
function GetAllServices(){
$.ajax({
type: "POST",
url: "/GetServices",
data: JSON.stringify({
"nummer": "-1",
}),
contentType: "application/json",
dataType: 'text json',
success: function(response) {
document.getElementById('resultblock').innerHTML = response
},
error: function(error){
console.log(error);
}
});
}
function AddService(){
$.ajax({
type: "POST",
url: "/AddService",
data: JSON.stringify({
"datum": document.getElementById('datum_input').value,
"tijd": document.getElementById('tijd_input').value,
"van": document.getElementById('van_input').value,
"tot": document.getElementById('tot_input').value,
}),
contentType: "application/json",
dataType: 'text json',
success: function(response) {
document.getElementById('resultblock').innerHTML = response
},
error: function(error){
console.log(error);
}
});
}
function DeleteService(date){
d = $(date).parent()[0].getAttribute("data");
$.ajax({
type: "POST",
url: "/DelService",
data: JSON.stringify({
"datum": d.split(" ")[0],
"tijd": d.split(" ")[1],
}),
contentType: "application/json",
dataType: 'text json',
success: function(response) {
document.getElementById('resultblock').innerHTML = response
},
error: function(error){
console.log(error);
}
});
}