【发布时间】:2015-06-09 19:27:28
【问题描述】:
对于以下示例:
var $ = require('jquery');
$.ajax({url : 'https://api.github.com/orgs/foo/members'})
.then(function(members) {
for (var i in members) {
$.ajax({url : 'https://api.github.com/users/' + members[i].login})
.then(function(member) {
console.log(member.name)
});
}
});
我明白了
$.ajax({url : 'https://api.github.com/orgs/foo/members'})
^
TypeError: undefined is not a function
at Object.<anonymous> (sample.js:2:3)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.## Heading ##js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
不知道如何解决。有什么帮助吗?
Notice that code in this answer is not helping me.我也一样
错误或类似TypeError: Cannot set property 'cors' of undefined的东西。
1 - 我不想要关于为什么我将 jquery 与节点一起使用的建议。我有一个理由,我在 Vim 中编码,想要轻松测试几乎与我将在浏览器中放入的代码相同的代码。如果你能提供一个关于这种节点用法的教程的链接,我会很高兴(我之前在某个遥远的时间做过这个,包括节点和犀牛)。
【问题讨论】: