Вот так работает правильно (заменить соотв кусок):
success: function(resp){
if(resp.length > 1) {
for (var i = resp.length - 1; i >= 0; i--) {
if(resp[i].s!='') {
text = text.replace(resp[i].word,resp[i].s);
}
};
editor.setData(text);
resp.length-=1;
alert('Исправлено ' + resp.length +' '+declOfNum(resp.length,['слово','слова','слов']));
} else {
alert('Ошибок не найдено');
}
}});