我正在使用以下代码来显示一个sencha面板。我正在尝试使用json从CMS中提取内容。我试图获得填充"html:"的响应的所有操作都失败了。也许我只是不明白范围?
App.views.howAttend = Ext.extend(Ext.Panel, {
initComponent: function () {
var resp = Ext.Ajax.request({
scope: this,
url: 'mobile-request/pages/how-attend',
success: function ( response ) {
var obj = Drupal.parseJson( response.responseText );
console.log(obj); // this is as expected
//this.html = obj.data doesn't work, neither does using obj.data below, in html:
},
failure: function ( response ) {
console.log (' server error ' + response.status);
}
})
//console.log(this);
App.views.howAttend.superclass.initComponent.call(this);
},
html: 'Nothing'// need to get html returned to here
});
您需要使用:
YourPanel.update(response.responseText);
在成功函数内部