Untitled

mail@pastecode.io avatar
unknown
javascript
a year ago
591 B
8
Indexable
	$('#btnOcean').click(function() {

		$.ajax({
			url: "libs/php/getOceans.php",
			type: 'POST',
			dataType: 'json',
			data: {
				latlon: $('#selOcean').val()
			},
			success: function(result) {

				console.log(JSON.stringify(result));

				if (result.status.name == "ok") {

					$('#txtDistance').html(result['data'][0]['distance']);
					$('#txtGeoname').html(result['data'][0]['geonameId']);
					$('#txtName').html(result['data'][0]['name']);
				}
				
			},
			error: function(jqXHR, textStatus, errorThrown) {
				// your error code
			}
		}); 
	
	});