0

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.

Anish
  • 2,889
  • 1
  • 20
  • 45

2 Answers2

1

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

stan229
  • 2,592
  • 19
  • 23
  • Thanks for the reply. I saw this in sencha docs. but i need to get a success msg or failure msg to know whether it is loading data or not. Thanxxx.... – Anish Nov 04 '11 at 03:24
  • All you would need to do is inside the function if(success) { // successful load } else { // fail } – stan229 Nov 04 '11 at 18:42
  • Hey pls go through this http://stackoverflow.com/questions/9563417/how-to-consume-soap-web-service-in-sencha-touch and give your valuable response... – himanshu Mar 05 '12 at 10:38
0

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);
}});
ilija139
  • 2,925
  • 3
  • 20
  • 23
  • This is for just a generic Ext Ajax request. Not for a store.load(). To leverage this you would have to manually create the models and call store.loadData() in the success. When you do store.load() it does the model reading automatically. – stan229 Nov 02 '11 at 19:21
  • Hey pls go through this http://stackoverflow.com/questions/9563417/how-to-consume-soap-web-service-in-sencha-touch and give your valuable response... – himanshu Mar 05 '12 at 10:38