I Have a script to where i get the city and state from a jquery get and when I ajax another url I get the console error "Uncaught ReferenceError: State is not defined"
Any Ideas?
jQuery(document).ready(function($) {
$.get("http://ipinfo.io", function(response) {
var City = response.city;
var State = response.region;
}, "json");
var weather_url = "http://api.wunderground.com/api/mykey/geolookup/conditions/q/" + State + "/" + City + ".json"
$.ajax({
url: weather_url,
dataType: "jsonp",
success: function(parsed_json) {
var location = parsed_json['location']['city'];
var temp_f = parsed_json['current_observation']['temp_f'];
alert(temp_f);
}
});
});
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>