2011-11-02 58 views
0

我正在研究sencha touch,如果我將數據傳遞給server.it,應該通過檢查它的數據庫來響應。它現在正在工作。但是當我傳遞不在服務器數據庫中的數據時,它不應該提供響應。 Loading Mask繼續加載...這裏是我的代碼以sencha觸摸從服務器獲得響應

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

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

是否有任何事情像ajax請求調用像成功/失敗的方法。

回答

0

這是當你從商店調用load方法,你如何讓一個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); 
}}); 
+0

這只是一個通用的Ext Ajax請求。不適用於store.load()。爲了利用這一點,您必須手動創建模型並調用store.loadData()才能成功。當您執行store.load()時,會自動執行模型讀取。 – stan229

+0

嘿請通過這個http://stackoverflow.com/questions/9563417/how-to-consume-soap-web-service-in-sencha-touch 並給你的寶貴迴應... – himanshu

1

,有你有填充回調屬性:這裏

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

+0

感謝您的答覆。我在sencha文檔中看到了這個。但我需要獲得成功的味精或失敗的味精才能知道它是否加載數據。 Thanxxx .... – Anish

+0

如果(成功){//成功加載} else {//失敗} – stan229

+0

您需要做的是在函數 之內嘿請通過這個http://stackoverflow.com/questions/ 9563417/how-to-soap-soap-web-service-in-sencha-touch 並提供寶貴的回覆... – himanshu

相關問題