diff --git a/js/script2.js b/js/script2.js index 2cbca46..5d767f1 100644 --- a/js/script2.js +++ b/js/script2.js @@ -106,6 +106,24 @@ function volDown() { })); } +function changeMapBounds() { + var xhr = new XMLHttpRequest(); + xhr.open("POST", "http://aa:8000/internet", true); + xhr.setRequestHeader('Content-Type', 'application/json'); + xhr.onreadystatechange = function () { + if (xhr.readyState === 4) { + console.log(xhr.response) + document.getElementById("volume_level").innerHTML = xhr.response + } + } + xhr.send(JSON.stringify({ + start_lat: 0, + start_lon: 0, + end_lat: 0, + end_lon: 0 + })); +} + function modal() { var modal = document.getElementById("info_modal"); var btn = document.getElementById("info_button"); diff --git a/scripts/internet_data.js b/scripts/internet_data.js index 26de055..13db5a8 100644 --- a/scripts/internet_data.js +++ b/scripts/internet_data.js @@ -83,13 +83,9 @@ setInterval(function () { }, 1000); app.post('/internet', (req, res) => { + console.log(req) return res.send('Received a POST HTTP method'); }); -app.get('/internet', (req, res) => { - return res.send('Received a GET HTTP method'); -}); - app.listen(8000, function () { - console.log('Example app listening on port ' + 8000 + '!'); }); \ No newline at end of file