Autoaddress 2.0 - Simple jQuery Plugin

1 Add our jQuery Plugin into your page and set options.

2 Type any address or Eircode to begin your search or choose a sample address below.

 

3 Use the onAddressFound Callback Event to auto-populate your form.


Next steps

See our Getting Started section for a step-by step guide 


Full HTML Example

Sample page layout:

<!DOCTYPE html> 
<html> 
<head> 
<!-- Add Latest compiled and minified Autoaddress CSS --> 
<link href="https://api.autoaddress.ie/2.0/control/css/autoaddress.min.css" rel="stylesheet"/> 
</head> 
<body> 
<!-- Add placeholder div to your page to place the plugin --> 
<div id="myDiv"></div>  


<div id="addressResult">
 <div><label>Address Line 1 :</label><div><input type="text" class="form-control" id="address1" /></div></div>
 <div><label>Address Line 2 :</label><div><input type="text" class="form-control" id="address2" /></div></div>
 <div><label>Address Line 3 :</label><div><input type="text" class="form-control" id="address3" /></div></div>
 <div><label>Town :</label><div><input type="text" class="form-control" id="address4" /></div></div>
 <div><label>County :</label><div><input type="text" class="form-control" id="address5" /></div></div>
 <div><label>Eircode</label><div><input type="text" class="form-control" id="postcode" /></div></div>
</div>

<!-- Add jQuery to your page --> 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Add Latest compiled and minified Autoaddress JS -->  
<script src="https://api.autoaddress.ie/2.0/control/js/jquery.autoaddress.min.js"></script>

<!-- Initialize the Autoaddress Plugin --> 
<script type="text/javascript"> 
   $(function(){
      $("#myDiv").AutoAddress({ 
         key : "YOUR_KEY",
         vanityMode : true,
         addressProfile : "DemoApi5Line",
         country : "ie",
         language : "en",
         onAddressFound: function(args){
             if (args.reformattedAddress) {
                 $.each(args.reformattedAddress, function (index, value) {
                     $('#address' + (index + 1)).val(value);
                 });
             }
             if (args.postcode) {
                 $('#postcode').val(args.postcode.slice(0, 3) + " " + args.postcode.slice(3));
             }
         } 
      }); 
   });
</script>
</body> 
</html>