Ext.Ajax.Request似乎不适用于我的桌面Web浏览器。它在设备和xcode模拟器上工作得很好,但在桌面Web浏览器上,它调用失败方法。下面是代码:Ext.Ajax.Request在浏览器中不起作用
// send ajax request
Ext.Ajax.request({
url: 'http://testapp.cloudapp.net/index.php/api/accounts/login/',
method: 'POST',
params: {
username: Ext.getCmp('username').getValue(),
password: Ext.getCmp('password').getValue()
},
dataType: 'json',
success : function(response, request) {
if(response.responseText == true) {
Ext.Msg.alert('validated');
// animate to wall view
Ext.Viewport.animateActiveItem(targetView, { type : 'fade' });
//destroy Login and Register Views
var vwRegister = Ext.ComponentQuery.query('register')[0],
vwLogin = Ext.ComponentQuery.query('login')[0];
setTimeout(function() {
vwRegister.destroy();
vwLogin.destroy();
}, 2000);
}
else {
Ext.Msg.alert('invalid user');
}
},
failure: function(response, request) {
Ext.Msg.alert('error');
}
});
我不认为这有什么做的“相同的起源”,因为我想这样做使用jQuery的$就功能同样的事情,它工作得很好。
是的,这是相同的来源政策。看看'Ext.data.JSONP'。 –
使用像XAMPP这样的本地网络服务器 –