stuck on issue with AJAX response being faster than db updates