avoid race conditions on firing two ajax