在诺基亚Series 40 /云预览上部署时,未执行ajax(PS - 诺基亚使用代理服务器在手机上运行网络应用程序)。 ajax调用可在桌面浏览器和本地预览(诺基亚Web工具)中使用。
</head>
<script language="javascript" type="text/javascript">
function findUserCity(){
$.ajax({
url : "http://api.wunderground.com/api/*******/geolookup/q/autoip.json",
dataType : "jsonp",
success : function(parsed_json) {
var city = parsed_json['response']['results'][0]['name'];
var cityId = parsed_json['response']['results'][0]['l'];
document.getElementById("userCityId").value=cityId;
document.getElementById("userCity").value=city;
findUserLocationWeather(cityId);
}
});
}
</script>
</head>
<body onload="findUserCity();jsonDataSource.init();">
<div class="container" >
<div class="strip view0" id="views">
<div id="homeview">
<div id="currentWeatherContainer" >
</div>
<div class="inputContainer">
<input type="hidden" id="userCityId" value=""/>
<input type="hidden" id="userCity" value=""/>
</div>
</div>
</div>
</div>
</body>
完整代码 - http://pastebin.com/dZFKPv1s