oldtimer/web/oldtimer.js

34 lines
1.0 KiB
JavaScript
Raw Normal View History

2023-10-10 07:15:19 +00:00
document.getElementById('nem-elerheto').textContent = 'Jelenleg minden autó elérhet ő!'
fetch('api/nemelerheto')
.then(res => {
res.json()
.then(json => {
document.getElementById('nem-elerheto').textContent = json.nemElerhetoAutok.toString()
})
.catch(console.error)
})
.catch(console.error)
function velemenyKuldes() {
const val = document.getElementById('velemenyInput').value
fetch('api/velemeny', {
method: 'POST',
body: JSON.stringify({
velemeny: val,
}),
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
})
.then(res => {
res.json()
.then(json => {
console.log(json)
document.getElementById('velemenyInput').value = ''
alert('Véleménye fontos számunkra!')
})
.catch(console.error)
})
.catch(console.error)
}