When working with backbone javascript models, we can obtain individual items like this:
var type = this.model.get("type");
The "type" variable is typically defined on the server side and then accessed in JavaScript using the above syntax.
But is it possible to retrieve the entire model at once?
I attempted this.model.toString()
, however it just displays [object object]
Any suggestions or advice?
UPDATE: The line of code mentioned above is being used in a backbone view rather than directly in the model. I need to access all the data from the model within this particular view, even if it's in JSON format. Is there a way to achieve this without creating a separate collection? I'd prefer to update the existing view code to get the complete model information.