我正在研究sencha touch,如果我将数据传递给server.it应该通过检查它的数据库来获取响应。它现在正在运作。但是当我传递不在服务器数据库中的数据时,它不应该带来响应。加载蒙版继续加载......这是我的代码
store.load({
params: {
name: 'xxxxx',
},
url:'search.php',
/*NOT WORKING
success:function()
{
},
failure:function()
{
}*/
});
是否有类似ajax请求调用的事情,如成功/失败方法。
答案 0 :(得分:1)
当你从商店调用load方法时,你需要填充一个回调属性:
callback: function(records, operation, success) {
//the operation object contains all of the details of the load operation
console.log(records);
}
此处全文(适用于ST1和ST2): Sencha Touch API Docs for Ext.data.Store
答案 1 :(得分:0)
这是您创建Ajax请求的方法
Ext.Ajax.request({
url: '140.45.45.20:9010/TService/Sms/Services',
params: form.getValues(),
method: 'GET',
success: function(response, opts) {
var obj = Ext.decode(response.responseText);
console.dir(obj);
//The request was successful - see the response in the response object
},
failure: function(response, opts) {
console.log('server-side failure with status code ' + response.status);
}});