2012-08-14 71 views
0

我是sencha touch 2開發的新手。在sencha touch中使用Web服務?

我的疑問是: -

1)如何消耗煎茶觸摸2 web服務?

2)如何將參數傳遞給webservice方法作爲該服務方法的輸入?

我請你幫忙。

任何參考或教程將幫助我很多。

在此先感謝。

回答

0

我用Ajax請求,以實現AJAX代理像這樣的目標:

 var resp = Ext.Ajax.request({ 
     method: 'post', 
     url: url, 
     jsonData: { 
      'method' : 'Product.search', 
      'params' : { 
       'pageSize' : 20, 
       'pageIndex' : 0 
      } 
     }, 
     async : true, 
     success : function(response, options){ 
      var sResult = Ext.decode(response.responseText); 
      Ext.Array.each(sResult['result']['datas'], function(obj){ 
       productModel = Ext.create('transport.model.Product', obj); 
       productStore.add(productModel); 
      }); 
      callback(); 
     }, 
     failure : function(response, options){ 

     } 
    });