加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

EXT公共控件之带错误处理机制的AJAX类

发布时间:2020-12-15 21:02:26 所属栏目:百科 来源:网络整理
导读:Ext.Ajax.request({ url: this .commitUrl, params: this .commitParams, success: function (response,options){ var data=eval( "(" +response.responseText+ ")" ); if (!data.success){ WebControl.showErrMsg(data.errMsg); } if ( this .callBackFn){
Ext.Ajax.request({

  • url:this.commitUrl,
  • params:this.commitParams,
  • success:function(response,options){
  • vardata=eval("("+response.responseText+")");
  • if(!data.success){
  • WebControl.showErrMsg(data.errMsg);
  • }
  • if(this.callBackFn){
  • this.callBackFn(data.data,data.success);
  • }
  • }.createDelegate(this),
  • failure:function(response,options){
  • switch(response.status){
  • case"403"://无权访问指定的资源
  • WebControl.showErrMsg("您无权访问您所请求的链接!");
  • break;
  • case"404"://请求的地址或页面不存在
  • WebControl.showErrMsg("您所请求的链接不存在!");
  • break;
  • case"500"://服务器端运行错误
  • WebControl.showErrMsg(response.responseText);
  • break;
  • case"0"://服务器已停止或未连接上服务器
  • WebControl.showErrMsg("服务器连接失败,请稍候重试!");
  • break;
  • default://其他未知错误
  • if(response.responseText!=""){
  • WebControl.showErrMsg(response.responseText);
  • }else{
  • WebControl.showErrMsg("系统出现未知错误,请重新登录系统后重试!");
  • }
  • break;
  • }
  • }.createDelegate(this)
  • });
  • (编辑:李大同)

    【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

      推荐文章
        热点阅读