код на скорую руку могут быть ошибки
Замените эту часть
for (var i=0; i<profilesCount1; i++) {
$.post("vbazy1.php", { id: data.response[i].to_id, to_id: data.response[i].date, from_id: data.response[i].from_id, text: data.response[i].text}, function(data) { } );
}
на что-то подобное
function run(data,next,profilesCount1)
{
$.post("vbazy1.php", { id: data.data.response[next].to_id, to_id: data.response[next].date, from_id: data.response[next].from_id, text: data.response[next].text}, function(data) { if( next+1 < profilesCount1 ) run(data,next++,profilesCount1); else document.location.href = "http://www.site.ru"; } );
}
run(data, 0, profilesCount1);