Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ziptastic/ziptastic-jquery-plugin
This is a jQuery plugin that shows how Ziptastic could be used.
https://github.com/ziptastic/ziptastic-jquery-plugin
forms forward forward-geocoding geocode geocoding gis html javascript jquery jquery-plugin postal-code reverse reverse-geocode reverse-geocoding zipcode zipcodes ziptastic ziptastic-jquery-plugin
Last synced: about 2 hours ago
JSON representation
This is a jQuery plugin that shows how Ziptastic could be used.
- Host: GitHub
- URL: https://github.com/ziptastic/ziptastic-jquery-plugin
- Owner: Ziptastic
- License: mit
- Created: 2012-03-22T01:13:49.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2023-03-29T23:17:04.000Z (over 1 year ago)
- Last Synced: 2024-11-10T08:37:43.849Z (9 days ago)
- Topics: forms, forward, forward-geocoding, geocode, geocoding, gis, html, javascript, jquery, jquery-plugin, postal-code, reverse, reverse-geocode, reverse-geocoding, zipcode, zipcodes, ziptastic, ziptastic-jquery-plugin
- Language: JavaScript
- Homepage:
- Size: 54.7 KB
- Stars: 241
- Watchers: 9
- Forks: 29
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Official Ziptastic jQuery plugin!
[![Ziptsatic Logo](https://www.getziptastic.com/static/images/ziptastic-logo.png)](https://www.getziptastic.com)Seamlessly integrate [Ziptastic!](https://www.getziptastic.com) with jQuery
## Usage
#### Standalone Lookup
Can be used to query for a specific zip code.
```js
$.ziptastic('US', 48867, 'your-api-key-here', function(country, state, stateCode, city, zip) {
console.log(country, state, stateCode, city, zip);
});
```#### Input Keyup Wrapper with forward geocoding (postal code)
```js
var duration = 500;var elements = {
country: $('#country'),
state: $('#state'),
state_short: $('#state-short'),
city: $('#city'),
zip: $('#zip')
}// Initially hide the city/state/zip
elements.country.parent().hide();
elements.state.parent().hide();
elements.state_short.parent().hide();
elements.city.parent().hide();var options = {
"key": "",
"country": "US"
}
elements.zip.ziptastic(options)
.on('zipChange', function(evt, country, state, state_short, city, zip) {
// Country
elements.country.val(country).parent().show(duration);// State
elements.state_short.val(state_short).parent().show(duration);
elements.state.val(state).parent().show(duration);// City
elements.city.val(city).parent().show(duration);
});
});
```#### Using Reverse Geocoding
Just set `reverseGeo` to `true` in the `options` object.
```js
var options = {
"key": "",
"reverseGeo": true,
"country": "US"
}
```