Lab Session: Weather Data: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 5: | Line 5: | ||
# Open LabWeather.nsx. | # Open LabWeather.nsx. | ||
# Add a click event to ''btnLoad'' on ''frmMain'' | # Add a click event to ''btnLoad'' on ''frmMain'' | ||
# Have the click event use the value from ''txtCity'' to query OpenWeatherMap's API: http://api.openweathermap.org/data/2.5/weather?q=Riyadh,sa (keep in mind that you should URL encode any user entered parameters, like city, using [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent encodeURIComponent]) | # Have the click event use the value from ''txtCity'' to query OpenWeatherMap's API: http://api.openweathermap.org/data/2.5/weather?q=Riyadh,sa&callback=weatherData (keep in mind that you should URL encode any user entered parameters, like city, using [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent encodeURIComponent]) | ||
# Upon receiving the response, you should parse the response into the various Value labels on frmMain. The format of the response is described here: http://bugs.openweathermap.org/projects/api/wiki/Weather_Data | # Upon receiving the response, you should parse the response into the various Value labels on frmMain. The format of the response is described here: http://bugs.openweathermap.org/projects/api/wiki/Weather_Data |
Revision as of 05:11, 14 December 2013
In this lab you will pull in some weather data from http://openweathermap.org/API.
Student Outline
- Open LabWeather.nsx.
- Add a click event to btnLoad on frmMain
- Have the click event use the value from txtCity to query OpenWeatherMap's API: http://api.openweathermap.org/data/2.5/weather?q=Riyadh,sa&callback=weatherData (keep in mind that you should URL encode any user entered parameters, like city, using encodeURIComponent)
- Upon receiving the response, you should parse the response into the various Value labels on frmMain. The format of the response is described here: http://bugs.openweathermap.org/projects/api/wiki/Weather_Data