Friday, 9 August 2013

Backbone Create

Backbone Create

For some reason this.collection.create() is returning an error, but
interestingly, the error message seems like the model I just added to my
collection.
this.collection.create({
name: $('#big-input').val(),
firstRemark: $('#small-input').val(),
postedBy: window.user.displayName,
twitterHandle: window.user.twittername,
pictureUrl: window.user.profilePic
},{wait: true,
success: function(response){
console.log("success");
console.log(response)
},
error:function(err){
console.log(err)
}
});
this is what I get after console.log(err):

exports.newPost = function(req, res){
console.log("GOT NEW TWEET REQUEST");
var newPost = new Post(req.body)
newPost.dateCreated = new Date();
newPost.save();
res.send(200);
};
Thanks to answers below I was able to print my 'real' error. As seen below
xhr.responseText is 'OK' and 'status' is 200. Why is this response
triggering a success but an error?

No comments:

Post a Comment