Anish
Anish

Reputation: 2927

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. 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

 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.

Upvotes: 0

Views: 1928

Answers (2)

stan229
stan229

Reputation: 2607

When you call the load method from a store, there's a callback property that you have to populate:

 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

Upvotes: 1

ilija139
ilija139

Reputation: 2974

This is how you can make an Ajax request

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);
}});

Upvotes: 0

Related Questions