Live Username Availability Check with PHP and jQuery AJAX Example

29

In this tutorial, we will see a PHP script to implement username live check feature using AJAX, jQuery, and MySQL. This is a common and popular feature in most of the websites available online.

While creating a user account, just after the user enters the username, an AJAX call will request the PHP page at the server side to get the availability status of the username. The PHP page matches the user input against the database and returns the response text based on the availability.

Check Username Availability Form Interface

This form contains username input field and triggers AJAX call on blur event of this input. The loader icon is shown to the user until the availability status is returned to the user interface.

jQuery AJAX Handler to Request User Availability

This Javascript function uses jQuery.ajax to send the username entered by the user along with the request for a PHP page.

Match Username against Database using PHP

This PHP script is executed as a result of the jQuery AJAX call. It compares database and user data to check username. Based on the availability status it will respond to the AJAX call.

 

Leave A Reply

Your email address will not be published.