fixed bug with success and rror messages, weren't waiting until all ajax requests returned before displaying