I began to integrate the highway into my project. The very first difficulty I came across was the response from the backend, was not JSON Array or not intended for the backbone. Here is an example.
var Person = Backbone.Model.extend({});
var PersonCollection = Backbone.Collection.extend({
model : Person,
url: '/people'
});
So consider that when I request / people, it does not return a JSON array of people. Instead, it returns something like:
{header: "some str", people: ["person", "array", ".."], stats: "something is here" }
A problem with this base is unable to assign this JSON response to the model. Are there any settings that can be made in the controller when answering. Therefore, access to the model may be normal. Any before / after hook.
FYI: the spine receives a response from the server, I see it under the key "responseText".
Any help is greatly appreciated.
source
share