Postcode Lookup - Crafty Clicks
UK postcode lookup, using input element IDs to config the Crafty Clicks JS,
HTML
<script src="https://cc-cdn.com/legacy/scripts/v4.9.2/crafty_clicks.class.min.js"></script>
<form method="post" name="address">
Postcode:<br/>
<input type="text" name="postcode" id="postcode" value="AA11AA"/>
<button type="button" onclick="cp_obj.doLookup()">Find Address</button><br/>
<span style="font-size:small">Use the free postcodes AA11AA, AA11AB, AA11AD or AA11AE.<br/>To try real data, you will need to paste an access token into this code!</span><br/>
<span id="crafty_postcode_result_display"> </span><br/>
Company:<br/>
<input type="text" name="companyname" id="companyname"/><br/>
Address:<br/>
<input type="text" name="address1" id="address1"/><br/>
<input type="text" name="address2" id="address2"/><br/>
<input type="text" name="address3" id="address3"/><br/>
Town:<br/>
<input type="text" name="town" id="town"/><br/>
</form>
JavaScript
var cp_obj = CraftyPostcodeCreate();
cp_obj.set("access_token", "xxxxx-xxxxx-xxxxx-xxxxx"); // your token here
cp_obj.set("result_elem_id", "crafty_postcode_result_display");
cp_obj.set("form", "");
cp_obj.set("elem_company" , "companyname");
cp_obj.set("elem_street1" , "address1");
cp_obj.set("elem_street2" , "address2");
cp_obj.set("elem_street3" , "address3");
cp_obj.set("elem_town" , "town");
cp_obj.set("elem_postcode" , "postcode");