syker
syker

Reputation: 11272

Triggering "error" callback function for jQuery AJAX from JAVA

How do you trigger the "error" callback function for jQuery AJAX from JAVA?

Upvotes: 0

Views: 685

Answers (2)

Jhong
Jhong

Reputation: 2752

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.

Upvotes: 0

Related Questions