Skip to content Skip to sidebar Skip to footer

Backbone Model Not Updating With Server Data

I'm new to Backbone, and I can't figure out this issue. Here's my model: var itinerary = Backbone.Model.extend({ defaults: function() { return { ItineraryID: null

Solution 1:

I'm assuming your JSON response is actually an array of JSON objects, in which case you will need to parse the response before adding it to the model by adding a parse method to your model definition.

Backbone.Model.extend({
... 
 parse : function(resp){
    return resp[0];
 },
});

Post a Comment for "Backbone Model Not Updating With Server Data"