为了账号安全,请及时绑定邮箱和手机立即绑定

为什么发布至weblogic上总是进入error?

为什么发布至weblogic上总是进入error?

江户川乱折腾 2022-10-26 23:19:57
用jquery的ajax做了一个联动的下拉列表,在tomcat中一切正常,但发布到weblogic上后,后台方法执行正常,但前台总是进入error方法,alter(e.message)显示undefined,搞了一晚上,彻底崩溃,请高手们给予指点,O(∩_∩)O谢谢!代码如下:var url = "<%=request.getContextgPath%>/testAjax/doAjax.so?id=" + id;$(function(){    url:url,    type:'post',    dataType:'json',    async:true,    cache:false,    success:function(data){       alert(data);    },   error:function(e){       alert(e.message);   }})
查看完整描述

2 回答

?
互换的青春

TA贡献1797条经验 获得超6个赞

(1)error属性的使用方式是不是有问题,第一个参数jqXHR,是不是没有message属性,正确使用并打印出错误信息可能对问题分析有帮助。以下为jquery api的说明:
error
Type: Function( jqXHR jqXHR, String textStatus, String errorThrown )
A function to be called if the request fails. The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event.
(2)怀疑:datatype属性,不知道你在服务端是怎么处理json返回的,返回的时候weblogic和tomcat会不会有不一致的地方;

查看完整回答
反对 回复 2022-11-01
?
守候你守候我

TA贡献1802条经验 获得超10个赞

你写错了吧:是 $.ajax 而不是 $(function(){
$.ajax({ url: "XXXX", success: function(){
  
      }});

查看完整回答
反对 回复 2022-11-01
  • 2 回答
  • 0 关注
  • 133 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号