With the use of jQuery AJAX you can instantly display whether the entered username is already been used or not by another user.
User doesn’t have to submit the form.
In this tutorial, I show how you can check username if it already exists in the PostgreSQL database or not using jQuery AJAX and PHP.