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

  • SEARCH
  • Home
  • 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 3934730
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:44:56+00:00 2026-05-19T23:44:56+00:00

I have made what is essentially a lightbox whereby if a change requires the

  • 0

I have made what is essentially a lightbox whereby if a change requires the user to confirm their password, this lightbox pops up and the user enters there password etc.

I am triggering the function like this:

if(verifyPassword())
{
    //apply change
}

The verify function is:

function verifyPassword() {
$('#confirmpasswordoverlay').fadeIn(300);

$('#submit').click(function() {
    $.post('', { password: $('input[name=password]').val() }, 
            function(check) {
                if(check.error)
                {
                    if(check.password)
                    {
                        //show password error
                        return false;
                    }
                    else
                    {
                        //show error
                        return false;
                    }
                }
                else
                {
                    return true;
                }
            }, 'json');
});

}

Basically I am needing the function to wait until #submit is clicked to return either true or false.

Thanks in advance

  • 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-19T23:44:57+00:00Added an answer on May 19, 2026 at 11:44 pm

    Since jQuery 1.5.0, you can do apply some magic with Deferred objects:

    $.when( verifyPassword() ).done(function() {
        // do something
    });
    

    You would need to re-write verifyPassword() a little:

    function verifyPassword() {
        var Notify = $.Deferred();
        $('#confirmpasswordoverlay').fadeIn(300);
    
        $('#submit').click(function() {
            $.post('', { password: $('input[name=password]').val() }, 
                    function(check) {
                        if(check.error) {
                            if(check.password) {
                                //show password error
                                Notify.resolve();
                            }
                            else {
                                //show error
                                Notify.reject();
                            }
                        }
                        else {
                            return true;
                        }
                    }, 'json');
            });
    
        return Notify.promise();
    }
    

    This might not be the most elegant way of achieving your goal here, I’m just saying you could do it in a way like this 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a site nearing structural completion. Essentially, it's made up of Users and
I have made an application for IPad in objective C. In this I am
I've made a binary tree where there are essentially three levels of structs: typedef
Please see this fiddle for my situation. Essentially, I have a floating span which
We have a long standing bug in our production code. This is essentially a
I have a simple game I made in java. Essentially, my programming ability is
I have this table: SUBSCRIPTION NAME SUBSCRIBER It's essentially a table having a list
We have made a change in our data model and we would like to
I am new to java-script and have made this script to popup this custom
Any ideas, i have made a previous post about this but i got no

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.