weixin_33694172 2015-12-24 00:10 采纳率: 0%
浏览 59

jQuery Ajax套接字错误

Happy holidays everyone. I'm getting occasionally the following ajax error:

Object error java.net.SocketException: Unexpected end of file from server

I have no space in data I send and encode the data as well. I have timeout set to 5000. I wonder if there is anything else I could try for the Socket error. Much appreciate your time... Here is my ajax call:

getURL = function(data){
    var obj = null;    
    obj = $.ajax({
         async:false,
         type:"POST",                 
         url: url,
         data: data,
         timeout: requestTimeout
      })             
    .done(function(data, textStatus, jqXHR){            
        if(data){
            if(data.status_code != 200)
            {
                console.log("ERROR Status returned:", data.status_txt);
            }
            else
            {                    
                url_rsp = data.data.url;
            }
        }
    })
    .fail(function(jqXHR, textStatus, errorThrown ){
        console.log("ERROR:", jqXHR, textStatus, errorThrown);
     });    

    return obj;   
}
  • 写回答

1条回答 默认 最新

  • 斗士狗 2015-12-29 00:20
    关注

    I was able to get around the error by forcing a second ajax post attempt after fail and that appears to cover most failed cases... The server is a 3rd party server, so I have no details on why the first post could fail.

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器