I'm using this code to connect to the server via jQuery
var jqxhr = $.post('@Url.Action("../CheckMessage")', { 'MessageId': MessageId },
function (data, s) {
alert ('This is executed on success only - data: ' + data + 's: ' + s);
}
)
.error(function(XMLHttpRequest, textStatus, errorThrown) { alert("error"})
If I create a new exception in the server .error
method is correctly executed, but if I take the server down, then success
method is executed.
How can I check if the connection to the server was lost?