【发布时间】:2014-05-10 05:39:58
【问题描述】:
我想从服务器上的 graph.facebook.com 获取 json 响应。我认为使用 jQuery 提供的 $.get 方法是个好主意,但是 Meteor 似乎没有在服务器上使用 jQuery。
$.ajax
url: 'http://graph.facebook.com/' + id
success: (data, status) ->
console.log data
这会触发以下错误:
$ is not defined
我已经运行了“meteor add jQuery”,但结果相同。那么首先,有没有比使用 $.get 更好的方法来从 graph.facebook.com 获取 json 响应?如果没有,如何在服务器上启用 jQuery?
【问题讨论】:
-
jQuery 是一个仅限客户端的库,您不能在服务器上使用它。
标签: javascript jquery json facebook meteor