开发者

Triggering "error" callback function for jQuery AJAX from JAVA

How do you trigger the "error" callback function for jQuery AJAX开发者_StackOverflow from JAVA?


See HttpServletResponse.sendError(int sc, String msg)


Nothing specific to Java... You just need to send output that was not expected (i.e. non-xml if you specify that the input should be xml in the jQuery ajax call), or return a header other than http 200.

Note that if you are using jsonp, the error callback doesn't work.

If you want to trigger an application error, you might be better off returning an error code as part of your data, and then process the error in the success callback function.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜