I have followed the instructions in the book and see there is a difference between the book and the book solution resource. Also, I believe the book solutions are one chapter behind. For instance chapter 12 solutions are actually chapter 13 Ajax.
Following the instructions in the book, I can’t see why this is throwing an error:
RemoteDataStore.prototype.getAll = function(cb) {
$.get(this.serverUrl, function(serverResponse) {
console.log(serverResponse);
cb(serverResponse);
});
};
This occurs after adding the get method to retrieve a single coffee order
RemoteDataStore.prototype.get = function(key, cb) {
$.get(this.serverUrl + ‘/’ + key, function(serverResponse) {
console.log(serverResponse);
cb(serverResponse);
});
};
Hi Francis,
If you’re calling “remoteDS.getAll();” see the errata, it should be remoteDS.getAll(function (data) { console.log(data); });
1 Like
Francis , .
Did you get his resolved? I am working on this one now. I also noticed the issues wth the solution. I got rid of the \ in the code as it already seemed to be there in the serverUrl
I am in need of some assistance because I am receiving the same error stating cb is not a function.
Thanks In Advance
Hey there!
Are you calling
remoteDS.getAll(function (data) { console.log(data); });
or just
remoteDS.getAll();
?
The error should go away if you use this version: remoteDS.getAll(function (data) { console.log(data); });
Let me know if that helps!
-Chris
Thanks Chrisaquinoa
I got the code to finally work, I had extra spaces in my code, once the extra spaces were gone, the code worked.