2014-01-17 6 views
0

그래서이 애플리케이션은 아래에있는 ajax 호출을 만들고 백본을 사용하여 요청을 구문 분석합니다. ie9 이하를 제외한 모든 브라우저에서 모든 것이 완벽하게 작동합니다. 나는 문제가 무엇인지 그리고 IE9 이하에서 항상 fetch()에서 실패하는 것 같은 이유를 파악하는 것 같다.백본 가져 오기가 IE9 이하에서 작동하지 않습니다.

도움이 될 것입니다.

window.ScheduleApp = { 
     Models: {}, 
     Collections: {}, 
     Views: {} 
    }; 

    window.template = function(id) { 
     return _.template($('#' + id).html()); 
    }; 

    //Define the Game Model. 
    ScheduleApp.Game = Backbone.Model.extend({ 
     initialize: function() { 
      this.gameId = this.get('Id'); 
      this.gameTime = this.get('Time'); 
     } 
    }); 

    //Define the Games Collection that contains Game Models. 
    ScheduleApp.Games = Backbone.Collection.extend({ 
     model: ScheduleApp.Game 
    }); 

    //Define the Day Model. 
    ScheduleApp.Day = Backbone.Model.extend({ 
     initialize: function() { 
      this.games = new ScheduleApp.Games(this.get('Games')); 
      this.games.parent = this; 
      this.gameDayDate = this.get('Date'); 
     } 
    }); 

    //Define the Days Collection that contains the Day Models. 
    ScheduleApp.Days = Backbone.Collection.extend({ 
     model: ScheduleApp.Day, 
     url: function() { 
      return '//domain/jsonfile.json' 
     }, 
     parse: function(data) { 
      var parsedSchedule = JSON.parse('[' + data + ']'); 
      console.log(parsedSchedule); 
      return parsedSchedule; 

     } 
    }); 

    ScheduleApp.DayCollectionView = Backbone.View.extend({ 
     el: '.container', //Container where the views get rendered to. 

     initialize: function() { 
      this.listenTo(this.collection, 'reset', this.render); 
     }, 
     render: function(event) { 

      //Cycle through collection of each day. 
      this.collection.each(function(day) { 
       console.log(day); 

       var dayView = new ScheduleApp.DayView({ 
        model: day 
       }); 

       this.$el.append(dayView.render().el); 

      }, this); 
      return this; 
     } 
    }); 

    ScheduleApp.DayView = Backbone.View.extend({ 
     tagName: 'div', 
     className: 'game-date', 
     template: _.template($("#gameDaySchedule").html(), this.model), 
     initialize: function() { 
      this.listenTo(this.model, "reset", this.render); 
     }, 
     render: function() { 
      this.$el.html(this.template(this.model.toJSON())); 
      return this; 
     } 
    }); 

    var daysList = new ScheduleApp.Days(); 

    daysList.fetch({ 
     reset: true, 
     update: true, 
     cache: false, 
     success: function(collection, response) { 
      console.log(collection); 
     }, 
     error: function(model, resp) { 
      console.log('error arguments: ', arguments); 
      console.log("error retrieving model"); 
     } 

    }); 

    //create new collection view. 
    var daysCollectionView = new ScheduleApp.DayCollectionView({ 
     collection: daysList 
    }); 
+0

"편안하고 지속성은 ... 오래된 인터넷 익스플로러 지원을 위해 jQuery를, 그리고 json2.js를 포함한다." – racraman

+0

당신이 저를 연결할 수 있을까 ? – Anks

+0

"다운로드 및 종속성"섹션의 http://www.backbonejs.org 앞 페이지에 있습니다. – racraman

답변

관련 문제