 var conPath =$("#contextPathNew").val();
 
 $.extend({
 
 /**
 * 覆盖$.post方法，用于统一捕获异常
 */
   ajaxRequest:function(opts){
        var rawMethod = opts.success;
        if(typeof(opts.data)=='object'){
            opts.data.continue_url=encodeURIComponent(window.location.href);
        }else{
            opts.data=opts.data+'&continue_url=' + encodeURIComponent(window.location.href);
        }
        opts.success=function(returnData)
                {
                   if ((opts.dataType=='json')&&(returnData.ajaxResult=='fail'))
                   {
                       $.dialog({title: "错误提示", content:  "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='"+conPath+"resources/default/images/popwin/messP.gif'  width='32' height='32' />"+returnData.msg+"<span style='display:none'>"+returnData.errorStack+"</span>", 
                          ok: "确定", id: "errorShowDiv", className: "", width: 335, modal: true});
                       if(undefined != $('.getCode'))
                       {
                    	   $('.getCode').attr("disabled",false); 
                       }
                   }else if ((opts.dataType=='html')&&(returnData.indexOf('ajaxResult')>0))
                   {
                       var jsonobj=eval('('+returnData+')');
                       $.dialog({title: "错误提示", content:"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='"+conPath+"resources/default/images/popwin/messP.gif'  width='32' height='32' />"+ jsonobj.msg+"<span style='display:none'>"+jsonobj.errorStack+"</span>", 
                          ok: "确定", id: "errorShowDiv", className: "", width: 335, modal: true});
                   }
                   else
                   {
                        rawMethod(returnData);
                   }
                };
        return $.ajax(opts);
    },
/**
 * 覆盖$.post方法，用于统一捕获异常
 */
   postRequest:function(url,data,callback,type){   
        if(typeof(data)=='object'){
            data.continue_url=encodeURIComponent(window.location.href);
        }else{
            data=data+'&continue_url=' + encodeURIComponent(window.location.href);
        }
        var newCallback=function(returnData)
                {
                   if ((type=='json')&&(returnData.ajaxResult=='fail'))
                   {
                       $.dialog({title: "错误提示", content: returnData.msg+"<span style='display:none'>"+returnData.errorStack+"</span>", 
                          ok: "确定", id: "errorShowDiv", className: "", width: 335, modal: true});
                   }else if ((type=='html')&&(returnData.indexOf('ajaxResult')>0))
                   {
                       var jsonobj=eval('('+returnData+')');
                       $.dialog({title: "错误提示", content: jsonobj.msg+"<span style='display:none'>"+jsonobj.errorStack+"</span>", 
                          ok: "确定", id: "errorShowDiv", className: "", width: 335, modal: true});
                   }
                   else
                   {
                        callback(returnData);
                   }
                };
        return $.post(url,data,newCallback,type);
    }  
  });
 
 /**
 * 覆盖form元素的ajaxSumbit方法，用于统一捕获异常
 */
 ;(function($) { 
   $.fn.ajaxFormSubmit = function(opts) {
        var rawMethod = opts.success;
        opts.success=function(returnData){
             if ((opts.dataType=='html')&&(returnData.indexOf('ajaxResult')>0))
             {
                 var jsonobj=eval('('+returnData+')');
                 $.dialog({title: "错误提示", content: jsonobj.msg+"<span style='display:none'>"+jsonobj.errorStack+"</span>", 
                    ok: "确定", id: "errorShowDiv", className: "", width: 335, modal: true});
             }
             else
             {
                  rawMethod(returnData);
             }
        };
        return $(this).ajaxSubmit(opts);
   }
 })(jQuery);
  
