我有一个从我的应用程序 launch()
函数中调用的简单函数:
function ajaxCall(){
Ext.Ajax.request({
url: 'ajax/Hello!', // Request should go to host/ajax url as http get request
// and server should return plain text `Hello!` as answer
success: function(response){
prompt('Ajax call success!', response.responseText); // My own prompting method
}
});
}
问题是这个请求似乎没有被提出。它不会出现在我的 Play 框架服务器上或 Google Chrome 的网络开发人员选项卡中。
编辑
程序似乎也卡在 Ext.Ajax.request
函数上。
最佳答案
以下用于 ajax 调用的代码对我来说效果很好。
Ext.Ajax.request({
async : true,
url : 'api/login/',
method : 'POST',
jsonData : {
"email":Ext.getCmp('loginUserNameTxtBoxId')._value,
"pwd":Ext.getCmp('loginPasswordTxtBoxId')._value,
},
success : function (request, resp) {
alert("in login success");
},
failure: function(request, resp) {
alert("in failure");
}
});
关于javascript - Sencha touch 2 无法使 Ajax 调用正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22438151/