We help IT Professionals succeed at work.

jquery or javascript for local temperature

Tom Knowlton
Tom Knowlton asked
on
Is there a way to display local temperature (City, State) using JavaScript or jQuery?
Comment
Watch Question

leakim971Multitechnician
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Tom KnowltonWeb developer

Author

Commented:
What webservice does it call?

Multitechnician
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
Tom KnowltonWeb developer

Author

Commented:
NOTES:


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
	$.ajax({
		url: "http://api.wunderground.com/api/003714f6d717816a/geolookup/conditions/q/IA/Cedar_Rapids.json",
		dataType: "jsonp",
		success: function(parsed_json) {
			var location = parsed_json['location']['city'];
			var temp_f = parsed_json['current_observation']['temp_f'];
			alert("Current temperature in "+location+" is: " + temp_f);
		}
	});
});
</script>

Open in new window

Tom KnowltonWeb developer

Author

Commented:
thx...it works!

Explore More ContentExplore courses, solutions, and other research materials related to this topic.