samedi 4 avril 2015

Beginning jquery on node, how to fix this?

For the following sample:



var $ = require('jquery');
$.ajax({url : 'http://ift.tt/1a1PNfE'})
.then(function(members) {
for (var i in members) {
$.ajax({url : 'http://ift.tt/1gcW4Wp' + members[i].login})
.then(function(member) {
console.log(member.name)
});
}
});


I get this



$.ajax({url : 'http://ift.tt/1a1PNfE'})
^
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.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3


No idea how to fix. Any help?


Aucun commentaire:

Enregistrer un commentaire