Posted inJavaScript / jQuery

check username availability using ajax and javascript – How to check if username already exists in database using JavaScript?

check username availability using ajax and javascript Live Username Availability Check using PHP and jQuery AJAX Example with full source code.

check username availability using ajax and javascript, PHP with MySQL

The CheckAvailability JavaScript function gets called when the Button is clicked.

Database Script for members Table


  `memberId` int(8) NOT NULL AUTO_INCREMENT,
  `memberName` varchar(55) NOT NULL,
  `password` varchar(55) NOT NULL,
  `firstName` varchar(55) NOT NULL,
  `lastName` varchar(55) NOT NULL,
  PRIMARY KEY (`memberId`)

INSERT INTO `members` (`memberId`, `memberName`, `password`, `firstName`, `lastName`) VALUES
(24, 'Rakesh', '', 'Rakesh', 'Bhandeto'),
(26, 'milan', '', 'davada', 'demoliya'),
(27, 'krish', '', 'krishna', 'kkv'),
(28, 'mayur', '', 'mayur', 'dhameliya');

Database connection


link = $this->connectDB();
        if(!empty($this->link)) {
    function connectDB() {
        $link = mysqli_connect($this->host,$this->user,$this->password,$this->database);
        return $link;
    function selectDB() {
        mysqli_select_db($this->link, $this->database);
    function numRows($query) {
        $result  = mysqli_query($this->link, $query);
        $rowcount = mysqli_num_rows($result);
        return $rowcount;

Don’t miss : PHP JQuery AJAX Live Check Email Availability

Check Username Availability Form Interface

jQuery AJAX Handler to Request User Availability

Match Username against Database using PHP


  if($member_count>0) {
      echo " membername Not Available.";
      echo " membername Available.";

I hope you get an idea about check username availability using ajax and javascript.
I would like to have feedback on my
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype