Google Groups

Re: JSON for a todolist


pmu Mar 18, 2012 11:16 AM
Posted in group: backbonejs
uff... stupid me:  that was not JSON below, providing clean JSON works
great, e.g.:

[{"content":"paint house","due_date":"2012-03-25 19:15:48
+0200"},{"content":"buy paint","due_date":"2012-03-19 19:15:48
+0100"}]


On Sun, Mar 18, 2012 at 6:59 PM, Patrick Mulder
<mulder....@gmail.com> wrote:
> Hello,
>
> for learning purposes, I am working out a Todo application.
>
> The TodoList is my collection, and and I want to fetch Todos from the
> server, however, the following JSON fails to be parsed into the
> TodoList:
>
> todolist.fetch()
> -->  [{"content"=>"paint house", "due_date"=>"2012-03-25 18:52:44
> +0200"}, {"content"=>"buy paint", "due_date"=>"2012-03-19 18:52:44
> +0100"}]
>
> But:
>
> todolist.models
> --> []
>
>
> My Collection is defined as follows:
>
> class DemoTodo.Collections.TodoList extends Backbone.Collection
>  model: 'Todo'
>  url: '/todolist'
>
> And my model:
>
> class DemoTodo.Models.Todo extends Backbone.Model
>
>
>
> Thanks for evt. feedback,
>
> Patrick