Zip to city state

Look for simple way to get city and state by provide zip code.
I have HTML form thanks
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Olaf DoschkeSoftware DeveloperCommented:
Google Geocoding API would help here.
Are you familiar with Javascript/jQuery, Ajax, API usage, XML/JSON?
Depending on that there's a steep learning curve ahead here.
I think you should know a bit of these and might suffice with the hint on the base address for the postal code request:<<zipcode here>>&key=<<Your Google API key here>>

Open in new window

Just as a starter, because that could lead you outside the USA easily, though Google will make the result depend on the location of the request, this could lead to wrong places for users searching US addresses with US zip codes. For example, I get German addresses.

Get a google account and api key here:

Bye, Olaf.
Bill PrewIT / Software Engineering ConsultantCommented:
If you have a real business need then it might be worth it to subscribe / pay for a service that has solid availability and updated data, etc.

If you are just looking for a casual capability, here's a couple of potential references worth a look.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jim RiddlesPrepress/OMS SpecialistCommented:
Possible duplicate of zip code to city list.

Bill already provided the same answer in that post.  Perhaps it would be better to stick to asking your question once.

That said, depending on your usage requirements, ZIP Code API offers a free account for up to 50 requests per hour, or you can sign up for a usage account, if you have greater needs.

ZIP Code API Examples
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

ITsolutionWizardAuthor Commented: is working me. But the State does not work to me - maybe because I use <select>
Let me know if you can help ....

Thank you for all your helps. You guys are awesome.

 <select tabindex="4"  style="text-transform:uppercase;" class="form-control" name="state" id="state">
Bill PrewIT / Software Engineering ConsultantCommented:
Can you share the rest of the related code, preferably in a sample web page?

Jim RiddlesPrepress/OMS SpecialistCommented:
I think the important question to ask yourself is why you are using a select input field if you are getting the data via and AJAX call based on the ZIP Code.  At that point, you are probably best served changing your State field to a text input field.

If you are forced to keep the select input control, then it is probably an issue with the JavaScript function.
Jim RiddlesPrepress/OMS SpecialistCommented:
Here's a JSFiddle showing their API in use with a select input for State.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.