Zip Code Validation

What I'm trying to do is have a form on my header where visitors can type in their zip code and it will tell them if they are in a certain service area or if they are not.

How can I do this?

Example

I believe there are sites that have an api that you can query US zip codes, it's been years since I've seen one so you'll need to search for them. Not sure if they are free or paid for.

Essentially, you'll either need to find a API you can query or download or make up on your own. Then use some JS code to query it or import into an array so that you can compare the array of possible zip codes to the inputted zip code and whether or not that zip code is in your service able area. Then based on that outcome display a notification to the client.

So this might be something to use in one way or another https://www.usps.com/business/web-tools-apis/welcome.htm

Saj

EDIT: meant to include this site that talks about validation https://stackoverflow.com/questions/160550/zip-code-us-postal-code-validation