May I suggest you double check the PHP code, first?
Easy to do.
Temporarily change the two uses of $_POST there to $_GET.
Then just hit that page from the browser using a URL such as
That is, passing in both email addresses in the db table and not, already registered and not. Do you get the results you expect?
If not, fix the PHP code.
If so, then indeed the but is in the JS code.