我试图连接到一个网站,从中提取JSON数据。主持人是我不确定的地方:HttpHost targetHost = new HttpHost("www.wunderground.com", 80);
HttpGet httpGet = new HttpGet(urllink); // urllink is "api.wunderground.com/<em
/api/0aa00aa0000aa0aa/alerts/q/34.933889,-103.760556.json" $URLWithVar = 'http://api.wunderground.com* This variable should now look like this: * http://api.wunderground.
我的目标是,当用户输入一个位置,而天气提供者没有该位置时,输入框就会摇动(这就是loadWeatherError()所做的)。下面的代码先运行else语句两次,然后运行if代码。所以当我运行它时,我得到了两次错误2警报,然后是一次错误1警报。有没有一种方法可以使loadWeatherError()函数只运行一次,并且只有在天气提供程序没有返回正确的数据时才运行?alert("Error 1"); if (data.respo