REST/JSON + jQuery UI Example

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.

by Rodrigo Fernández Díaz

HTML

<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/redmond/jquery-ui.css">
<html>
    <head>
        <title>REST/JSON + jQuery UI Example</title>
    </head>
    <body> 
        
    </body>
</html>

CSS

.address-result {
    cursor: pointer;
    margin-bottom: 10px;
    padding: 5px;
}
.address-result:hover {
    background-color: lightgray;
}
.complete-address {
    display: none;
}
.title {
    color: gray;
    font-size: smaller;
    margin-bottom: 12px;
}
#invalid {
    color: red;
    font-size: smaller;
    margin-bottom: 20px;
}

JavaScript

$(document).ready(function() {
        $.ajax({
            type: 'post',
            async: false,
            url: 'https://f537f5c5657d7b5581f032c80c5baabe.us-east-1.aws.found.io/elasticsearch/_msearch',
            headers:
            {
              'Accept':'application/json, text/plain, */*',
              'Referer':'https://f537f5c5657d7b5581f032c80c5baabe.us-east-1.aws.found.io/app/kibana',
              'Origin':'https://f537f5c5657d7b5581f032c80c5baabe.us-east-1.aws.found.io',
              'kbn-version':'5.5.2',
              'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36',
              'content-type':'application/x-ndjson',
              'cookie':'sid=Fe26.2**5717bedcb0980d69134554d901121f55a132b1f90cdbbd1ac2eea6030ec016f5*yZN-CrY5_rMLSvxTGKFj8A*8PymyO3Nf9tQKYVrzvyYz1UMvGcC7gk8w-ntoFJKav2fhXBvKIgPCtV7RGuS0_HVPG7mgNG89T5sXFk5tVearX_xCqF0Ss3VAAR896gDBrI**bf5e1e20c08ad05b46de0ab017faca58d485fc64cd44faff8dcd36c6d7b84b53*ZuqNo8dWColoEM9ylRdTyR3R7qgGHGnRw99QyWNFl6Y'
            },
            data:...