Skip to content

Instantly share code, notes, and snippets.

@johnsonch
Created November 13, 2014 04:43
Show Gist options
  • Save johnsonch/4fccb13bd57e38f870ad to your computer and use it in GitHub Desktop.
Save johnsonch/4fccb13bd57e38f870ad to your computer and use it in GitHub Desktop.
airport demo app, ajax get weather report
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
.
.
.
<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