Javascript 无效的http响应,请选择要使用的代码

Javascript 无效的http响应,请选择要使用的代码,javascript,jquery,ajax,http,Javascript,Jquery,Ajax,Http,我有一个servlet,它将卡片存储到数据库中。在js中,我使用jqueryajax请求从servlet获取卡片,servlet从数据库获取卡片。如果他们还没有添加任何卡,我只想提醒他们,不要做其他事情。因此,如果来自db的卡为空,那么我希望使用不同的http代码发送响应,以指示js执行警报。如果我使用浏览器显示的错误代码,我尝试使用方法not accepted 405。但是简单的成功代码是“无效的”,根据chrome,我尝试了100个继续 if(nextCard ==

我有一个servlet,它将卡片存储到数据库中。在js中,我使用jqueryajax请求从servlet获取卡片,servlet从数据库获取卡片。如果他们还没有添加任何卡,我只想提醒他们,不要做其他事情。因此,如果来自db的卡为空,那么我希望使用不同的http代码发送响应,以指示js执行警报。如果我使用浏览器显示的错误代码,我尝试使用方法not accepted 405。但是简单的成功代码是“无效的”,根据chrome,我尝试了100个继续

            if(nextCard == null){
                response.setStatus(HttpServletResponse.SC_CONTINUE);
                //send back empty list error...
                response.getWriter().write("user hasn't added any cards yet");
                return;
            }
ajax请求:

$.ajax({
      type:"get",
      url:"QuestionPage",
      data:{name:"next",result:result},
      success: function(response,status) {
          if(status == 100){
              alert('You havent added any cards yet, these waters are calm... go chum the water and come back when they start to circle.');
              return;
          }
          cardReievedUpdateUI(response);
      }
   });
我也试过:

$.ajax({
          type:"get",
          url:"QuestionPage",
          data:{name:"next",result:result},
          success: function(response,status) {
              cardReievedUpdateUI(response);
          },
          statusCode: {
              100: function(){
                     alert('You havent added any cards yet, these waters are calm... go chum the water and come back when they start to circle.');
              }
           }
       });
这就是导致浏览器显示错误的原因,我只是想告诉自己该怎么做

这是我的错误:

未能加载资源:net::ERR\u无效\u HTTP\u响应

我该怎么做


错误截图:

根据chrome,简单成功代码是“无效”的,是吗?HTTP状态代码可以正常工作。我认为200应该可以正常工作。返回空数组,而不是返回null。(可选)204(无内容)也可以工作。204工作正常。真奇怪。