Javascript console.log在JS文件中不工作
我试图在一个较大的项目中调试一个JavaScript文件,由于某种原因,console.log()没有向我的控制台视图输出任何内容。我也尝试过其他函数,如alert(),但它们也给出了相同的结果 这是我的密码:Javascript console.log在JS文件中不工作,javascript,extjs,syntax,Javascript,Extjs,Syntax,我试图在一个较大的项目中调试一个JavaScript文件,由于某种原因,console.log()没有向我的控制台视图输出任何内容。我也尝试过其他函数,如alert(),但它们也给出了相同的结果 这是我的密码: Ext.define('chefRoleSetupFormPanel', { extend: 'Ext.form.Panel', id: 'chefRoleSetupFormPanel', title: 'Role Information', url:
Ext.define('chefRoleSetupFormPanel', {
extend: 'Ext.form.Panel',
id: 'chefRoleSetupFormPanel',
title: 'Role Information',
url: 'chefCreateRole.php',
bodyPadding: 10,
items: [{
xtype: 'textfield',
name: 'roleName',
fieldLabel: 'Name',
allowBlank: false,
anchor: '100%'
}, {
xtype: 'textareafield',
grow: true,
name: 'roleDescription',
fieldLabel: 'Description',
anchor: "100% 75%"
}],
buttons: [{
text: 'Reset',
handler: function() {
this.up('form').getForm().reset();
}
}, {
text: 'Submit',
formBind: true, //only enabled once the form is valid
disabled: true,
handler: function() {
var form = this.up('form').getForm();
if (form.isValid()) {
form.submit({
success: function(form, action) {
var roleSetupForm = Ext.getCmp('chefRoleSetupFormPanel');
roleSetupForm = roleSetupForm.getForm();
var roleName = roleSetupForm.findField('roleName')['value'];
var roleDescription = roleSetupForm('roleDescription')['value'];
var chefRequiredCookbooksGrid = Ext.getCmp('chefRequiredCookbooksGrid');
var runList = chefRequiredCookbooksGrid.getStore().getRange();
console.log(runList);
roleSetupForm.submit({
params: {
roleName: roleName,
roleDescription: roleDescription,
runList: JSON.stringify(runList)
}
})
},
failure: function(form, action) {
}
});
}
}
}]
});
你知道为什么会这样吗
谢谢尝试登录失败。您可能有一个未捕获的错误。console.log()非常好,但我建议使用Ext.log(…) 这只是我被建议遵循的最佳实践 用法:
Ext.log({level:'debug'}, 'Message Here');
您是否测试了函数是否遇到了
故障
?很高兴我能提供帮助:)等等,很抱歉,实际上是来自PHP脚本的错误消息告诉我没有发出请求。我删除了对脚本的调用,但仍然无法执行console.log()。您肯定在某个地方仍然有错误。继续记录那次失败。您确定form.isValid()
?