0

似乎当我的 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
 },
4

1 回答 1

0

这是一个古老的问题,但以防万一其他人也有类似的问题:这里的一个问题是函数被命名gotHistoryFailed,并且种类定义onFailure: gotHistoryFailure必须完全匹配,否则将不会调用处理程序。

于 2012-06-04T06:50:24.773 回答