![](/img/trans.png)
[英]HighCharts not working on Safari but works fine on Firefox and Chrome
[英]My Script is not working in Chrome and Firefox (Mac) but works in Safari?
任何帮助,将不胜感激。 我的脚本似乎可以在Safari中使用,但不能在其他任何浏览器上使用? 我很茫然,因为我是Jquery和解析的新手。 谢谢!
jQuery(document).ready(function($) {
/* Edit these variables */
var api = "66ffde1312******";
var state = "TX";
var city = "Dallas";
$.ajax({
url : "http://api.wunderground.com/api/" + api + "/conditions/q/" + state + "/" + city + ".json",
dataType : "jsonp",
success : function(parsed_json) {
var icon_url_json = "http://icons.wxug.com/i/c/f/" + parsed_json['current_observation']['icon'] + ".gif";
var icon_json = '<img src ="' + icon_url_json + '" />';
var temp_json = parsed_json['current_observation']['temp_f'];
temp_json += "<span>°F</span>";
var condition_json = parsed_json['current_observation']['weather'];
var real_feel_json = "Feels Like " + parsed_json['current_observation']['feelslike_f'] + "°F";
var wind_json = 'Winds are ' + parsed_json['current_observation']['wind_string'];
var location_json = city + ', ' + state;
document.getElementById("weather-icon").innerHTML = icon_json;
document.getElementById("temp").innerHTML = temp_json;
document.getElementById("condition").innerHTML = condition_json;
document.getElementById("real-feel").innerHTML = real_feel_json;
document.getElementById("wind").innerHTML = wind_json;
document.getElementById("location").innerHTML = location_json;
}
});
});
和html:
<div class = "weather">
<div id = "weather-icon"></div>
<div class = "text-container">
<p id = "condition"></p>
<p id = "temp"></p>
<p id = "real-feel"></p>
<p id="wind"></p>
<p id="location"></p>
</div>
</div>
最好的方法是在Chrome中调试并找出中断的确切行。 在chrome上,您可以按F12键在控制台中查看错误。 在此之前,请尝试注释掉天气图标div设置内部html,这对我来说似乎有点奇怪。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.