Integration with HTML::Mason 

<&| ‘/js-autocomplete.comp’ &>
      $(“form.enrol-form input#house”).autocomplete(
        ‘/js-ac/anon/residential-address’,
        {
          requestType:‘POST’,
          dataType:‘json’,
          minTest:function(str) {
            if(str.match(/\S\s+\S\S\S/) || str.length > 6) return true;
            return false;
          },
          matchSubset:false,
          matchContains:false,
          scroll:true,
          cacheLength:1,
          autoFill:false
        }
      ).result(function(event, rec) {
        $(“form.enrol-form input#house”).val(rec.house_number);
        $(“form.enrol-form input#street_name”).val(rec.street_name);
        $(“form.enrol-form input#town_suburb_name”).val(rec.town_city);
        $(“form.enrol-form input#town_suburb_name”).focus();
      });
</&>