Here is a proof similar to what the OP has tried:
Let $\lambda$ be any eigenvalue of $AB$ with corresponding eigenvector $x$. Then
$$ABx = \lambda x \Rightarrow \\ BABx = B\lambda x \Rightarrow\\ BA(Bx) = \lambda (Bx) $$
which implies that $\lambda$ is an eigenvalue of $BA$ with a corresponding eigenvector $Bx$, provided $Bx$ is non-zero.
Suppose $Bx$ is the zero-vector. As If $x$ is an eigenvector, it is non-zero$Bx = 0$, sothen $Bx = 0$$ABx = 0$ implies the $B$ is singular. Then both $AB$ and $BA$ are singular, andthat $\lambda = 0$ (as $ABx = 0$) is a common eigenvalue.
Thus, $AB$ and $BA$ have the same non-zero eigenvalues.