일본 주소 api 테스트

This commit is contained in:
이대환
2026-02-02 10:11:42 +09:00
parent 252a27601e
commit a7dd13fc65

View File

@@ -22,6 +22,31 @@
$('[name=dlvylcAreaCd]').on('change', fn_toggle_langHeader); $('[name=dlvylcAreaCd]').on('change', fn_toggle_langHeader);
fn_toggle_langHeader(); fn_toggle_langHeader();
}); });
const fn_select_postcodeJp = function () {
console.log();
$.ajax({
url: 'https://zipcloud.ibsnet.co.jp/api/search?zipcode='+$('#zip').val(),
type: 'GET',
dataType: 'json',
success: function (Data) {
console.log(Data);
let result = Data.results;
console.log(result);
console.log(result[0]);
if (res.status === 200 && res.results && res.results.length > 0) {
console.log("addresss1 : "+res.results[0].address1);
console.log("addresss2 : "+res.results[0].address2);
console.log("addresss3 : "+res.results[0].address3);
}
},
error: function (xhr, status, error) {
console.error('API 호출 실패:', error);
}
});
}
</script> </script>
<div id="dlvylcRegist" class="modal default" style="max-width: 600px;"> <div id="dlvylcRegist" class="modal default" style="max-width: 600px;">
<form id = "dlvylcRegistForm"> <form id = "dlvylcRegistForm">
@@ -65,8 +90,8 @@
<th class="langJp">郵便番号<span class="required-asterisk">*</span></th> <th class="langJp">郵便番号<span class="required-asterisk">*</span></th>
<td> <td>
<input type="text" class="m-input short" id="zip" name="zip" title="우편번호" maxlength="7" readonly> <input type="text" class="m-input short" id="zip" name="zip" title="우편번호" maxlength="7" readonly>
<button class="find-address-btn langKr" onclick="fn_select_postcode(fn_select_dlvylc_postcode); return false;">우편번호 찾기</button> <button class="find-address-btn" onclick="fn_select_postcode(fn_select_dlvylc_postcode); return false;">우편번호 찾기</button>
<button class="find-address-btn langJp" onclick="fn_select_postcodeJp(); return false;">検索</button> <button class="find-address-btn" onclick="fn_select_postcodeJp(); return false;">検索</button>
<input type="text" class="m-input long my" id="adres" name="adres" maxlength="66" readonly title="주소"> <input type="text" class="m-input long my" id="adres" name="adres" maxlength="66" readonly title="주소">
<input type="text" class="m-input long" id="dtlAdres" name="dtlAdres" title="상세주소" maxlength="66" placeholder="나머지 주소를 입력해 주세요"> <input type="text" class="m-input long" id="dtlAdres" name="dtlAdres" title="상세주소" maxlength="66" placeholder="나머지 주소를 입력해 주세요">
</td> </td>