Atiyah-Mcdonald, Exercise 1.6 
A ring $A$ is such that every ideal not contained in the nilradical contains a non­zero idempotent (that is, an element $e$ such that $e^2=e\ne0$). Prove that the nilradical and Jacobson radical of $A$ are equal.

Solutions for this book exist but I would if you help me with where I specifically going wrong instead of providing a solution. There are similar questions on this site, but I specific help with understanding what is going wrong in the quotient. Here is my attempt:
It is enough to show that every prime ideal is maximal. We do this by showing for arbitrary prime ideal $p$, $A/p$ is a field. Let $x\in A-p$, its image $\overline{x}$ is nonzero. Then the ideal generated by $x$ is not in the nilradical. By our assumption there is a nonzero $e=e^2$ in $(x)$, write $e=ax$. Then we see that $e(e-1)=0$. Then $\overline{ax}\cdot\overline{ax-1}=0\in A/p$. Since the quotient is an integral domain, we either have $\overline{ax}=0$ or $\overline{ax-1}=0$. Here starts my confusion. We would like to conclude that since $e$ was non zero $\overline{ax}$ is non zero, but it could be possible if $e\in p$ that $e$ be non zero and $\overline{ax}$ be zero.
Similar questions:
Check my proof that the nilradical and the Jacobson radical are equal (A&M 1.6) and  Atiyah-Macdonald, Problem 6 of Chapter 1
 A: Edit: There are mistakes in the first paragraph (see below). But looking at a finite product of fields is still sufficient to understand where your proof goes wrong.
If we look at $A/\operatorname{nil}(A)$ then that is a ring in which every ideal contains an idempotent. So that is a semisimple ring and hence it is a finite product of fields (there's a proof of this somewhere on this site, just make sure you're specifically looking for commutative rings). When you have a finite product of fields, every prime ideal is necessarily maximal.
Where your proof comes short is that you take just any idempotent but there might be multiple idempotents and you need to somehow identify one that will work.
For instance, consider $A = \mathbb{R}^2$ with $e_1 = (1,0), e_2 = (0,1)$. Let $x = (1,1)$ (so the identity) and let $P = \ker((u,v) \mapsto u)$.
We have three idempotents in $(x)$ but let us focus just on $e_1$ and $e_2$. And now, let us look at what happens in your proof depending on which of the idempotents we take. Since $x$ is the identity, in every case we are going to decompose $e = ax$ with $a = e$. So now:

*

*$e = e_1$ then $ax \equiv 1 \pmod P$

*$e = e_2$ then $ax \equiv 0 \pmod P$.

So you see it is possible that $ax \equiv 0 \pmod P$ if we choose the wrong idempotent.
