16
$.ajax({
url: url,
dataType: 'json',
data: data,
success: callback,
timeout: 3000 //3 second timeout,
error: function(jqXHR, status, errorThrown){ //the status returned will be "timeout"
//do something
}
});