Проблему с setTimeout решил, получился конечно быдло код (как в принципе и в оригинале), но зато работает. Вдруг кто с поиска забежит, выложу свое решение.
jQuery.ajax({
beforeSend:function(){
if(jQuery("#ajx-processing").length == 0 )
var $message=jQuery('<span id="ajx-processing"></span>').appendTo("#commentform");
jQuery("#ajx-processing").html('Комментарий скоро будет добавлен. Пожалуйста подождите...').show(0).delay(2000).hide(0);
return
},
type:'post',
url:jQuery(this).attr('action'),
data:jQuery(this).serialize(),
dataType:'html',
error: function (xhr) {
if(xhr.status==500){
setTimeout(function(){
if(jQuery("#ajx-error").length == 0 )
var $message=jQuery('<span id="ajx-error"></span>').appendTo("#commentform");
jQuery("#ajx-error").html(xhr.responseText.split('<p>')[1].split('</p>')[0]).delay(4000).hide(0);
}, 1500);
}
else if(xhr.status=='timeout'){
setTimeout(function(){
var $message=jQuery('<span id="ajx-error"></span>').appendTo("#commentform");
jQuery("#ajx-error").html('Error:Server time out,try again!').delay(4000).hide(0);
}, 1500);
}
else{
jQuery("#ajx-error").html('too fast error').delay(4000).hide(0); //too fast error
}
},
К сожалению, я еще так и не смог найти инфо о том как в js можно было бы вставить стили вида <style></style>, если вообще можно -)