category = new Category({name: name, img: img});
category.save(null, {
success: function(){
console.log("saved")
},
error: function(){
console.log("error")
}
});
I have a form, and when the submit button is clicked, it captures the name and img data and the code above is run.
However, the POST request remains pending, and is completed only when I refresh the page. Even though the data is saved in the database, an error callback is being called. I don't know what is going wrong here, I'm new to Backbone and I'm using Backbone Relational in this case