Backbone parsing json response

前端 未结 2 777
走了就别回头了
走了就别回头了 2021-02-09 20:58

I\'ve been using Backbone for a total of 3 days now, and I can see that this has been asked about quite a lot, but honestly I\'m just not getting it. I\'ve been banging my head

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-09 21:42

    model comes with parse method , so when ever you are making mode.fetch() request , the output can be parse in model itself

    example :

    model = Backbone.Model.extend({ urlRoot:"/category/", parse : function( data ) { console.log(data); } })

    var Model = new model({})

提交回复
热议问题