Вот мое решение с setTimeout
и clearTimeout
http://jsfiddle.net/laukstein/2wcpU/7/
$('#content').ajaxStart(function(){
$(this).html('Loading...');
});
var timer=window.setTimeout(function(){
$('#content').html('Loading seems to be taking a while. Try again.');
},2000);
$.ajax({
type:"GET",
url:'http://lab.laukstein.com/ajax-seo/.json',
dataType:'jsonp',
success:function(data){
window.clearTimeout(timer);
$('#content').html(data.content);
},
error:function(){
window.clearTimeout(timer);
$('#content').html('The request failed. Try to refresh page.');
}
});