34 lines
1.0 KiB
JavaScript
34 lines
1.0 KiB
JavaScript
|
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)
|
||
|
}
|