简体   繁体   English

在sencha touch中从服务器获取响应

[英]Getting response from a server in sencha touch

I am working on sencha touch where if i pass a data to a server.it should brings the response by checking it's database. 我正在使用sencha touch,如果我将数据传递到server.it应该通过检查数据库来带来响应。 it's working now. 现在正在工作。 but when i pass the data which is not in the server database it shouldn't bring a response. 但是当我传递不在服务器数据库中的数据时,它不会带来响应。 Loading Mask keeps loading...Here's my code 正在加载Mask正在继续加载...这是我的代码

 store.load({
    params: {
    name: 'xxxxx',
    },
    url:'search.php',
/*NOT WORKING   
 success:function()
    {

    },
   failure:function()
  {
  }*/
    });

is there any thing like ajax request call like success/failure method. 是否有像成功/失败方法这样的ajax请求调用之类的东西。

When you call the load method from a store, there's a callback property that you have to populate: 从商店调用load方法时,必须填充一个回调属性:

 callback: function(records, operation, success) {
        //the operation object contains all of the details of the load operation
        console.log(records);
    }

Full text here (applies to both ST1 and ST2): Sencha Touch API Docs for Ext.data.Store 此处全文(适用于ST1和ST2): 用于Ext.data.Store的Sencha Touch API文档

This is how you can make an Ajax request 这是您可以发出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);
}});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM