0
這似乎是當我的Web服務發生錯誤時,onFailure方法未被調用。一個例子是如果該文件不在服務器上,則不會被調用。所以我的全部都有一個供用戶按下的按鈕。如果Web服務不存在,則不會發生任何事情。Enyo嘗試檢測Web服務何時不起作用
我假設我的程序有偵測這些錯誤的方法,所以我可以顯示消息?????
代碼片斷 {名: 「getHistory」,類型: 「web服務」, 的onSuccess: 「gotHistory」, onFailure處: 「gotHistoryFailure」, 方法: 「POST」, 網址:「HTTP://127.0 .0.1:8500/icechat /服務器/ loadhistory.cfm」 },
/////////////////////////////////////////////////////////////////////////////////
// Call back, called when the history data has been loaded from web services
gotHistory: function(inSender, inResponse) {
// Convert data from server to a jason object
// NOTE: The string should be checked first for embeded javascrip code
this.serverReply2= inResponse;
this.$.list.render();
},
//////////////////////////////////////////////////////////////////////////////////
// Called if the history data could not be loaded from the web service
gotHistoryFailed: function()
{
alert("got infortion failed"); // this never goes off
},
如果您在webOS中作爲應用程序運行,請知道alert()是無操作的 - 您需要其他一些機制,例如使用'enyo.log'來記錄失敗。 – 2012-04-13 19:22:15