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 $x$ is an eigenvector, it is non-zero, so $Bx = 0$ implies the $B$ is singular. Then both $AB$ and $BA$ are singular, and $\lambda = 0$ (as $ABx = 0$) is a common eigenvalue.
Thus, $AB$ and $BA$ have the same eigenvalues.