Using the onAddressFound(data) Callback, you can use the response data to auto-populate a sample form.
The Autoaddress jQuery Plugin can also search in Postally Compliant mode. To switch the control to search for Postal Addresses you just need to configure the vanityMode
property to set to false
and use the postalAddress
in the response.
<script type="text/javascript">
$(function(){
$("#myDiv").AutoAddress({
key : "YOUR_KEY",
vanityMode: false,
addressProfile: "Demo5LineV2"
onAddressFound: function (data) {
if (data.postalAddress) {
$.each(data.postalAddress, function (index, value) {
$('#addressLine' + (index + 1)).val(value);
});
}
if (data.postcode) {
$('#postcode').val(data.postcode);
}
}
});
});
</script>