Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6577519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:38:49+00:00 2026-05-25T15:38:49+00:00

I have 2 fields: Username Email When ether field is focused out, I would

  • 0

I have 2 fields:

  1. Username

  2. Email

When ether field is focused out, I would like to display a loader while ajax call
is checking if username or email already exists (depends on focused out field)

This is the jquery code I wrote:

$().ready(function () {
    $("#Username, #Email").bind('focusout', processCheck);
});

function processCheck() {
    if ($(this).val() == '')
        return;
    $(this).next().find('img').bind('ajaxStart', loading);
    $.ajax({
        type: "POST",
        url: 'Is' + $(this).attr("id") + 'Exists',
        data: "{'" + $(this).attr("id") + "':'" + $(this).val() + "'}",
        contentType: "application/json; charset=utf-8",
        async: true,
        dataType: "json",
        success: function (msg) {

        }
    });
}

function loading() {
    $(this).show().unbind('ajaxStart').bind('ajaxStop', loadingStop);
}

function loadingStop() {
    $(this).hide().unbind('ajaxStop');
}

Well, it’s not working as expected 🙂

The first focus out works fine. Then, second one not fires until first one is done.

I need that to work async for both fields.

Any ideas how to make it happen?

Thanks in advanced!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:38:50+00:00Added an answer on May 25, 2026 at 3:38 pm

    I’m not certain jquery register the ajaxStart and ajaxStop custom
    events in the dom, but anyway, $.ajaxStart() and $.ajaxStop() don’t
    really work that way. They are like event code “wrappers”. I could
    propose you a solution with these two functions, but you don’t need
    them.

    function processCheck() {
        var $this = $(this);
        if ( $this.val() == '' ) return;
        $img = $this.next().find('img');
        $img.show();
        $.ajax({
            type: "POST",
            url: 'Is' + $this.attr("id") + 'Exists',
            data: "{'" + $this.attr("id") + "':'" + $this.val() + "'}",
            contentType: "application/json; charset=utf-8",
            async: true,
            dataType: "json",
            success: function (msg) {
                // stuff
                $img.hide();
            }
        }).always(function () { 
            $img.hide(); 
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Django form with a username and email field. I want to
I developed a screen in which there are fields like first name,username,password and email.
I have set my database fields username and email to unquie, when using the
I have a table with the following fields: email - name - username -
Suppose I have a application form which contain lot of boxes like email,username,age etc...I
I make a login form with dynamic field validation. I have 3 fields username,
i have one signup form where i have three field username,password and email address
Let's say you have a class called Customer, which contains the following fields: UserName
I want to allow users to either have there username field empty at any
When designing user table what would be the must have fields from the security/user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.