1

在诺基亚 Series 40/云预览版上部署 ajax 时不会执行(PS - 诺基亚使用代理服务器在手机上运行 Web 应用程序)。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

4

0 回答 0