似乎当我的 Web 服务出现错误时,没有调用 onFailure 方法。一个例子是,如果文件不在服务器上,或者被调用。所以我的所有人都有一个按钮供用户按下。如果 Web 服务不存在,则不会发生任何事情。
我假设我的程序有办法检测这些错误,所以我可以显示一条消息??????
代码片段{name:“getHistory”,种类:“WebService”,onSuccess:“gotHistory”,onFailure:“gotHistoryFailure”,方法:“POST”,url:“http://127.0.0.1:8500/icechat/server/ 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
},