function btnFind() { // Reset Rows $("#alertBox").hide(); $(".alert").html(""); $('.alert').removeClass('alert-warning').removeClass('alert-danger').addClass('alert-warning'); $("#spinnerBox").hide(); $("#txtOutput").hide(); // Set Vars let txtAddress = $("#txtAddress").val() + ""; // Quick test to make sure address was entered. if (txtAddress === "") { $(".alert").html("You have to enter an address first."); $("#alertBox").show(); return; } // Show Spinner $("#spinnerBox").show(); // API - Call geocode API // K = (Required) Key, allows access to API // C = (Required) Command, // LL - Will return the Lat/Lon of a given address. // DIST - Will return the distance information. // T = (Optional) Test, Test Mode = 1 will only pull one record from the DB // ADDRESS = Address you want to return the Lat/Lon or Distance from. $.ajax( { url : 'https://rhays.us/Examples/RX_API_Two/RX2.php', type : 'GET', dataType: 'json', data : { 'K' : 'RLH4321', 'C' : 'DIST', 'T' : '1', 'address' : txtAddress, }, success : function(data) { switch(data.status.toUpperCase()) { case 'OK': sOutput = '
The Pharmacy closest to the address location you entered is:
'; sOutput = sOutput + 'Pharmacy: ' + data.pharmacy + 'Approx. Drive time and distance:
'; sOutput = sOutput + 'Distance: ' + data.distance + '