我的咖啡脚本看起来像这样:
initialize = ->
$.ajax
url: "map_groups/1.json"
type: "get"
dataType: "json"
success: (response) ->
console.log response
mapOptions =
center: new google.maps.LatLng(response.latitude, response.longitude)
zoom: 16
mapTypeId: google.maps.MapTypeId.ROADMAP
问题是,mapOptions
需要能够访问 ajax 响应。我怎样才能增加范围response
以便它可以被访问mapOptions
?