how to use Backbone Collection to fetch this JSON result?

前端 未结 1 869
误落风尘
误落风尘 2021-01-25 21:45

I have the following JSON reply

{
   \"results\":[
      {
         \"Product\":{
            \"id\":\"1\",
            \"short_name\":\"Infra - 2200 CAS Sma SIM         


        
相关标签:
1条回答
  • 2021-01-25 22:44

    Your Products is a Collection class, not a Collection object. Changing your code to

    new Products().fetch()
    

    or

    var Products = new (Backbone.Collection.extend(...))
    

    should work. Besides, if you want to customize how to parse the JSON reply, you could override collection.parse.

    0 讨论(0)
提交回复
热议问题