IM STUCK >:(. Cannot figure anything out

This commit is contained in:
eetnaviation
2024-03-15 22:53:19 +02:00
parent 1787f42830
commit 64fb01cccf
3 changed files with 142 additions and 38 deletions

View File

@ -38,18 +38,9 @@
// Function to handle form submission
document.getElementById('search-form').addEventListener('submit', function(event) {
//event.preventDefault(); // Prevent the form from submitting normally
var tak = document.getElementById('bus-id').value.trim();
socket.emit('takSearch', tak);
});
socket.on('takSearch', function(data) {
// Process the received data and update the map accordingly
// For example:
data.forEach(function(item) {
var marker = L.marker([item.latitude, item.longitude]).addTo(map);
marker.bindPopup(`Transport Type: ${item.transportType}<br>Line Number: ${item.lineNumber}<br>TAK: ${item.tak}`);
});
});
</script>