Wait for ajax before clicking buttons