In the weather array I am using, rain only shows up if it's raining. How do I do I skip a field if it is not in the array and move on?
$.ajax({
type: 'GET',
url: "http://api.openweathermap.org/data/2.5/forecast?lat="+latitude+"&lon="+longitude+"&units=imperial&APPID=removed",
success: function(response) {
icon = "wi-day-"+response.list[0].weather[0].main.toLowerCase();
$('#city').html(response.city.name);
$('#country').html(response.city.country);
$('#current_temp').html(Math.round(response.list[0].main.temp)+' ºF');
$('#weather_description').html(response.list[0].weather[0].description);
$('#weather').html(response.list[0].weather[0].main);
$('#max_temp').html(Math.round(response.list[0].main.temp_max)+' F');
$('#min_temp').html(Math.round(response.list[0].main.temp_min)+' F');
$('#humidity').html(response.list[0].main.humidity+' %');
$('#rain_volume').html(response.list[0].rain[3h]+'"');
$('#wind_speed').html(response.list[0].wind.speed+'MPH');
console.log(response);
}
});
The line I am talking about
$('#rain_volume').html(response.list[0].rain[3h]+'"');