1
가에서 responseText 내가 기대하지만 실패() 메서드에서 항상 빈 문자열 (완료) 메소드에서 jQuery 코드jQuery를 포스트 실패() 콜백
var posting = $.post(
url,
json
).fail(function(jqXHR, textStatus, errorThrown) {
alert("An Error Occurred: "+jqXHR.responseText);
}
).done(function(response, textStatus, jqXHR) {
alert("Success: " + jqXHR.responseText);
}
)
;
을 고려 빈에서 responseText에게 있습니다.
서블릿 코드는 그래서 같다 : 나는 jqXHR.responseText를 볼 것으로 예상하고있어 실패 할 방법은
try {
doSomething();
response.getOutputStream().print("doSomething worked properly");
}
catch (Exception e) {
response.sendError(500, e.getMessage());
response.getOutputStream().print("doSomething failed with error: " + e.getMessage());
}
서블릿 인쇄 문에서 값을 가지고 있지만, 대신에 항상 비어 있습니다.