var ajaxReq = new Ajax.Request ('Test.jsp', {
method: 'get',
onSuccess: function (transport) {
alert ('OK');
},
onFailure: function (transport) {
alert ('Failure');
}
});
Is the response a successful one?
The following is a list of guidelines for this kind of business.
onException: function (requesterObj, exceptionObj) {
ajaxReq.options.onFailure (null);
}
var ajaxReq = new Ajax.Request ('Test.jsp', {
method: 'get',
onSuccess: function (transport) {
alert ('OK');
},
onFailure: function (transport) {
// this gets invoked if the server responds with an error code.
alert ('failure');
},
onException: function (requesterObj, exceptionObj) {
ajaxReq.options.onFailure (null);
},
on0: function (transport) {
// this gets invoked if the server is down.
ajaxReq.options.onFailure (transport);
}
});
Source: https://habr.com/ru/post/46240/
All Articles