This is an alternate UI option for the LiveAddress API. It makes use of jQuery, jQuery UI, and jQuery Templates in order to query our REST/JSON endpoint.
/*
Make sure to register the following domain with your LiveAddress Subscription:
fiddle.jshell.net
This can be done from here (once you're logged in):
https://smartystreets.com/account/api/javascript
Also, make sure to insert your Javascript API Access Identifier below as the 'auth-token' value (also found at the link above)!
Then just click the "Run" button above, fill in an address and click "Verify".
NOTE: if you're thinking of using this code on your site, make sure to grab the resources by copying the link addresses in the "Manage Resources" section (to the left).
*/
function suppress(event) {
if (!event)
return false;
if (event.preventDefault)
event.preventDefault();
if (event.stopPropagation)
event.stopPropagation();
if (event.cancelBubble)
event.cancelBubble = true;
return false;
}
$(document).ready(function() {
$('form#address').submit(function(event) {
var givenAddress = {
'user_input': true,
'delivery_line_1': $('#street').val(),
'delivery_line_2': $('#street2').val(),
'last_line' : $('#city').val() + ', ' + $('#state').val() + ' ' + $('#zip').val(),
'components' : {
'city': $('#city').val(),
'zipcode': $('#zip').val(),
'state_abbreviation': $('#state').val()
}
};
$.ajax({
type: 'get',
url: 'https://api.qualifiedaddress.com/street-address/',
dataType: 'jsonp',
async: false,
data: {
'auth-token': 'YOUR_AUTHENTICATION_TOKEN_OR_HTML_IDENTIFIER',
'street': givenAddress.delivery_line_1,
'street2': givenAddress.delivery_line_2,
'city': givenAddress.components.city,
'state': givenAddress.components.state_abbreviation,
'zipCode': givenAddress.components.zipcode,
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.