getJSON
is just shorthand for ajax
with a few values already set. And ajax
has a timeout
option. That is probably the most reliable option (but obviously won't respond to network failure immediately). I personally would combine it with any checks you can find for determining network status.
$.ajax({
dataType: "json",
url: url,
data: data,
success: success,
timeout: 10000 // 10 seconds
});