70 likes | 201 Views
This article provides a solution for finding a city or ZIP code in the U.S. using a free API from gomashup.com. It demonstrates how to use JavaScript alongside Knockout.js to fetch and display city information, including names, ZIP codes, latitude/longitude, and the corresponding county. The guide covers Knockout.js basics, such as data bindings—option, checked, visible, and foreach bindings—along with the concept of subscriptions to ensure dynamic updates of dependent values. For a practical implementation, visit the provided JSFiddle link or explore the GitHub repository for complete code examples.
E N D
JavaScript using an API with Knockout By: Caleb Briggs
Problem • Finding a city or zip code in the US and knowing its name, zip code, latitude/longitude and county its in
Solution • Using a free API from gomashup.com with an html page and javascript to accomplish this.
Knockout Basics • Data Bindings • Option Binding • Checked Binding • Visible Binding • For Each Binding • Subscriptions • Subscribing to a value can ensure that when a value on the page changes we can update other values that depend on the value that you are subscribed to
Code Teaser • Navigate to http://jsfiddle.net/tLBWY/15/
Now to the real codes • Pull down my git repo with an example of this here