1/** 2 * Postal Code API by Made for _____ Team 3 * https://github.com/madefor/postal-code-api 4 */ 5jQuery(function($){ 6 $("input[name='zipcode']").keyup(function(){ 7 var zip = $("input[name='zipcode']").val(); 8 getAddress(zip, $("textarea[name='address']")); 9 }); 10 11 $("input[name='company_zipcode']").keyup(function(){ 12 var zip = $("input[name='company_zipcode']").val(); 13 getAddress(zip, $("textarea[name='company_address']")); 14 }); 15 16 function getAddress(zip, $output) { 17 zip = zip.replace("-", ""); 18 19 if (zip.length >=7) { 20 var zip1 = zip.slice(0,3); 21 var zip2 = zip.slice(3,7); 22 $.ajax({ 23 url:'https://jp-postal-code-api.ttskch.com/api/v1/' + zip + '.json', 24 dataType: "json", 25 async: true, 26 }).done(function(data, textStatus, jqXHR){ 27 $output.val(data.addresses[0].ja.prefecture + data.addresses[0].ja.address1 + data.addresses[0].ja.address2); 28 }).fail(function(jqXHR, textStatus, errorThrown){ 29 console.log(errorThrown); 30 }) 31 } 32 } 33});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.