0
아래 코드의 두 console.log는 다음을 보여줍니다. 데이터 객체는 'title', 'position'및 'content'가있는 json 형식입니다. 그러나 console.log에서 데이터를 보는 방법을 모르겠습니다. 예를 들어 console.log("data " + data[0].title)
을 사용하여 첫 번째 데이터 객체의 제목을 가져 왔지만 undefined가 반환되었습니다. '이'물건에 관해서는, 나는 그것이 무엇인지를 실제로 알지 못합니다. 이것은 백본 응용 프로그램의 라우터보기에서 초기화 기능입니다.이 기능은 해체하려고 시도하고 있지만이 상황에서 '이것이'무엇인지 파악할 수 없습니다. 당신이 문자열에 추가 할 때'object Object'에 대한 추가 정보 얻기
**this** [object Object]
**data** [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
코드는
initialize: function (options)
{
var _this = this;
console.log("this " + this);
$.ajax({
url: "json/Backboneapp_data.json",
dataType: 'json',
data: {},
async: false,
success: function (data)
{
console.log("data " + data)
_this._data = data;
_this._items = new ItemCollection(data);
_this._view = new MenuView({ model: _this._items });
_this._view.render();
Backbone.history.loadUrl();
}
});
return this;
},
'console.log' 대신'debugger'를 입력하고 개발자 도구가 열려 있으면 모든 가능한 정보를 얻을 수 있습니다. – dfsq