Created
November 13, 2014 04:43
-
-
Save johnsonch/4fccb13bd57e38f870ad to your computer and use it in GitHub Desktop.
airport demo app, ajax get weather report
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getWeather = (url) -> | |
$("#results").html "" | |
if url | |
$.ajax | |
method: "get" | |
url: url | |
success: (data) -> | |
console.log data | |
console.log url | |
return | |
error: (data) -> | |
console.log data | |
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
. | |
. | |
<script> | |
var url =<%=raw "'http://api.openweathermap.org/data/2.5/weather?lat=#{@airport.latitude_deg}&lon=#{@airport.longitude_deg};'" %> | |
console.log('document ready'); | |
getWeather(url); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment