how to parse json data,i need to display each and every data inside a div element. I am using world weather online api service to access weather data
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
</head>
<body>
<input type="text" id="in"></input>
<input type="hidden" id="keys" value="api"></input>
<input type="hidden" value="json" id="format"></input>
<button id="go">Search</button>
<script>
$(document).ready(function(){
$("#go").click(function(){
var apikey = $("#keys").val();
var q = $("#in").val();
var format = $("#format").val();
jQuery.ajax({
url: 'http://api.openweathermap.org/data/2.5/weather?key=' + apikey + '&q=' + q + '&format=' + format,
success: function(response) {
var obj = JSON.parse(response);
console.log(obj);
},
});
});
});
</script>
</body>
</html>
Example output for berlin:
http://api.openweathermap.org/data/2.5/weather?key=api&q=berlin&format=json
{"coord":{"lon":13.41,"lat":52.52},"sys":{"message":0.0826,"country":"DE","sunrise":1433386009,"sunset":1433445756},"weather":[{"id":800,"main":"Clear","description":"Sky is Clear","icon":"01d"}],"base":"stations","main":{"temp":290.628,"temp_min":290.628,"temp_max":290.628,"pressure":1037.43,"sea_level":1043.19,"grnd_level":1037.43,"humidity":81},"wind":{"speed":2.42,"deg":314.504},"clouds":{"all":0},"dt":1433424243,"id":2950159,"name":"Berlin","cod":200}
divelement and how does the data look like?