这是我的代码:
Ext.onReady(function() {
Ext.create('Ext.panel.Panel', {
title: 'Results',
width: 600,
height: 400,
renderTo: Ext.getBody(),
items: [{
xtype: 'container',
layout: 'form',
style: 'width : 200px;margin-top: 10px ',
items: [{
xtype: 'textfield',
fieldLabel: 'Name',
id: 'name',
style: 'width : 100px;'
}]
}, {
xtype: 'container',
layout: 'form',
style: 'width : 200px;margin-top: 10px ',
items: [{
xtype: 'datefield',
fieldLabel: 'Date',
id: 'date'
}]
}, {
xtype: 'container',
layout: 'form',
style: 'width : 200px;margin-top: 10px ',
items: [{
xtype: 'textfield',
vtype: 'email',
fieldLabel: 'EmailId',
id: 'email'
}]
}, {
xtype: 'container',
layout: 'form',
style: 'margin-top: 10px ',
items: [{
xtype: 'button',
text: 'signup',
float: 'right',
handler: function() {
Ext.Ajax.request({
method: 'GET',
url: 'rest/helloworld/',
disableCaching: false,
success: function() {
Ext.Msg.alert('', 'success');
Window.Location.assign('abc.js');
},
failure: function() {
Ext.Msg.alert('', 'failed');
},
params: {
name: Ext.getCmp('name').getValue(),
email: Ext.getCmp('email').getValue(),
date: Ext.getCmp('date').getValue()
}
});
}
}]
}
]
});
});
一切都很顺利:
我真正需要的是在成功警报后加载另一个 ExtJS 页面。
我尝试了 Window.Location.assign('abc.js')
但它不起作用。
Extjs 新手。
请帮忙
最佳答案
问题 1(与 Ext-JS 无关):不是 Window.Location
,而是 window.location
问题2(Ext-JS问题):Ext.Msg.alert
对话框是异步的。 location.assign('www.google.com')
行将在对话框显示后立即运行,而不是在关闭后运行
要等到按钮按下后,您必须向其传递一个回调。
Ext.Msg.alert('','success', function() {
// Note that window is not necessary here, just location.assign will do
window.location.assign('abc.js');
});
关于javascript - 扩展 : Redirecting to other page,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29522623/