郵便番号から住所を検索する #1
jQuery lookup プラグイン を使って、指定した郵便番号の住所を検索し、その結果をリスト表示します。
<script type="text/javascript">
//<![CDATA[
jQuery(function($) {
jQuery(document.f)
.submit(function() {
jQuery('#r')
.empty()
.lookup(document.f.c.value, function(response) {
jQuery.each(response, function() {
jQuery('<li>')
.text(this.a + ' (' + this.k + ')')
.appendTo('#r');
});
});
return false;
});
});
//]]>
</script>
<form name="f">
<input type="text" name="c" value="160-0021" size="20" />
<input type="submit" name="g" value="検索" />
</form>
<ul id="r"></ul>
関連情報
- ベーシック
- 送信フォーム
- with jQuery
- Google Maps API
- BLOGRANGER API
