I am trying to get the variable value of data.latitude (line 483) out of the jquery.getAddress-4.0.0.js file into my index.html. I created a new line after line 483 and created a new variable in which I set data.latitude by doing so:
if (self.$output_fields.latitude) {
self.$output_fields.latitude.val(data.latitude || "");
var userLatitude = data.latitude;
}
Then in index.html I use the following code to retrieve the variable
$( document ).ready(function() {
    $('#postcode_lookup').getAddress({
        api_key: '', 
        output_fields:{
            line_1: '#line1',
            line_2: '#line2',
            post_town: '#town',
            postcode: '#postcode',
            latitude: '#latitude',
            longitude:'#longitude'
        },
        onAddressSelected: function(elem,index){
            console.log(userLatitude);
        }
    });
But it doesn't seem to work and I get the following error: getaddress.html:51 Uncaught ReferenceError: userLatitude is not defined
Here is the link to the .js file https://getaddress-cdn.azureedge.net/scripts/jquery.getAddress-4.0.0.js
Does anyone know how to get this variable into the index.html file?
 
     
    