// Function to load and parse the CSV file function loadCSV() { var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function () { if (xhr.readyState === XMLHttpRequest.DONE) { if (xhr.status === 200) { // Parse CSV data var zipCodes = xhr.responseText.split('\n'); searchZipCodes(zipCodes); } else { console.error('Failed to load CSV file'); } } }; xhr.open('GET', 'zipcode1.csv', true); xhr.send(); } // Function to search for the entered zip code function searchZipCodes(zipCodes) { var inputZip = document.getElementById('zip-input').value; if (zipCodes.includes(inputZip)) { alert('We serve your area!'); } else { alert('Sorry, we do not serve your area at the moment.'); } }
We cover your area !
We don't cover your area !
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.