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 8236529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:09:48+00:00 2026-06-07T19:09:48+00:00

I have a situation here: I have a user login form with a intermediate

  • 0

I have a situation here:

I have a user login form with a intermediate dialog popup(consists of a dropdown) to validate roles of user which is populated by an ajax call.

The issue is the when i click on submit for form the intermediate dialog popups and dropdown is not populated with roles, it populates after 5-7 secs in which the dropdown is empty.

Can we handle in ajax, using status or when ajax is complete then we can popup the dialog box with dropdown populated.

Below is my code:

Form

<form name = "loginForm" method="post" action="#">
    <div class = "container">
    <table>
        <tr>
            <td>
                <h1 class = "heading">Enhanced Quality Control 2.0</h1><br>
            </td>
        </tr>
        <tr>
            <td>
                <table class = "maintable">
                    <tr>
                        <td>
                            <table>
                                <tr>
                                    <td>
                                        <label for="login">Login ID&nbsp;&nbsp;</label>
                                    </td>
                                    <td>    
                                        <input id="login" type="text" onfocus="clearDefault(this.value);" onblur="setDefault();" value="Enter your Login ID" style="position:relative; margin-left: 80px; background-color:#19A053;border:none;width:100%;height:26px;color:#FFFFFF;font-size:20px;padding-left:10px;font-style:italic"/>
                                    </td>
                                </tr>   
                                <tr>
                                    <td>
                                        <br><label for="password" >Password&nbsp;&nbsp;</label>
                                    </td>
                                    <td>
                                        <br>
                                        <input id="password" type="password" onfocus="clearDefault(this.value);" onblur="setDefault();" value="Enter Password" style = "position:relative; margin-left: 80px; background-color:#19A053;border:none;width:100%;height:26px;color:#FFFFFF;font-size:20px;padding-left:10px;font-style:italic"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td>
                                        <br>
                                        <input type = "checkbox" style= "background-color:#19A053" style="position:relative; margin-left: 80px; background-url:images/user.png">&nbsp;&nbsp;Remember me next time</input>
                                    </td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td>
                                        <br>
                                        <img class="submit" src = "images/button.PNG" name = "image" style="position:relative; margin-left: 80px; background-color:#19A053;border:none;" />
                                        <input type="hidden" value="" id="role" />
                                    </td>   
                                </tr>
                            </table>
                        </td>
                        <td>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    </div>
    </form>

Intermediate Dialog Code


<div id="dialog" title="Select User Role" style="display:none;">
        <p>You have multiple user roles assigned. Please select any one of the roles and click on the 'Continue' button.</p>
        <table>
            <tr>
                <td>Select user role</td>
                <td>
                    <div class="dropdown" id="dropdown">
                        <select id="roles" name="Select user role" style="z-index: 10;"> //EMPTY DROPDOWN
                    </select>
                </div>
                </td>
            </tr>
        </table>
    </div>

SCRIPT CODE
    **

    $(document).ready(function(){ 
                // Dialog Link
                $('.submit').click(function () {
                    makeGetRequest();           //Call for First Click and shoot ajax call
                });


                function makeGetRequest() { // AJAX CALL METHOD
                    var login = document.getElementById('login').value;
                    var password = document.getElementById('password').value;
                    http.open('get', 'ajax.jsp?login=' + login+ '&password=' + password);
                    http.onreadystatechange = processResponse; //CALLBACK FUNCTION
                    http.send(null);
                }

    //AJAX CALLBACK FUNCTION - Issue is the dialog opens up before the dropdown is populated i need to wait a bit 
                function processResponse() {
                    if(http.readyState == 4 && http.status == 200){
                        var response = http.responseText;

**
                    document.getElementById('roles').innerHTML = response;
                    $('#dialog').dialog('open'); //Dialog Opens before data is ready in my "roles" dropdown
                }

            }

Thanks in advance!!!!
Cheers…

  • 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-06-07T19:09:50+00:00Added an answer on June 7, 2026 at 7:09 pm

    consider using jQuery.get() function adding the script you want to execute on ajax return in the return function(data):

    $.get('ajax/test.html', function(data) {
    
        $('.result').html(data);
        alert('Load was performed.');
    
    });
    

    Where data is your server response.

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

Sidebar

Related Questions

I have a simple situation here. lets face html code first => <form name=geoKey
I have a unique situation over here. I have a button on a form
Here's my current situation: I have a NSMutableArray named dictKeyArray which I assign a
Here is the situation, I have a login page as the initial rootView of
I have the follow problem. This is the situation i've got when user login
ok here is the situation , I want to use a login form for
I have an situation here that looks very like a SELECT N+1 from the
I have a strange situation here. In my android app, I have a layout
I have a really tough situation in here. There is an array of these
I don't know if you have run into a similar situation but here's a

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.