Can you please tell me what is wrong with this code? It’s not giving me any output after clicking submit.
$('#btnRun').click(function() {
$.ajax({
url: "libs/php/getCountryCode.php",
type: 'POST',
dataType: 'json',
data: {
lat: $('#lat1').val(),
lng: $('#long1').val()
},
success: function(result) {
console.log(JSON.stringify(result));
if (result.status.name == "ok") {
$('try').html(result.data.countryCode);
}
},
error: function(jqXHR, textStatus, errorThrown) {
// your error code
}
});
});
The result is obtained is this format:
{
"languages": "de-AT,hr,hu,sl",
"distance": "0",
"countryCode": "AT",
"countryName": "Austria"
}