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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:42:38+00:00 2026-06-01T14:42:38+00:00

I am creating an user registration form using jsp,in which there is an option

  • 0

I am creating an user registration form using jsp,in which there is an option to select State from a combo box.I am using a simple html combo box but i am receiving State as a json object from web service.So how to populate the combo box with json object.

State Json is as follows,

{"States":[{"id":"1","stateName":"Alabama","code":"AL"},
{"id":"4","stateName":"Arkansas","code":"AR"},
{"id":"8","stateName":"Delaware","code":"DE"}]}

My Javascript function is,

function getStates(){    
url = WSPath;
response=initiateRequest(url);}

My HTML combo box is <select name="State">

I need to populate the combo-box with the above json object.

  • 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-01T14:42:39+00:00Added an answer on June 1, 2026 at 2:42 pm

    Pure js:

    var select = document.createElement("select");
    var obj = JSON.parse(response);
    
    for (var i=0; i < obj.States.length; i++)
    {
      var option = document.createElement("option");
      option.id = obj.States[i].id;
      option.value = obj.States[i].code;
      option.innerHTML = obj.States[i].stateName;
      select.appendChild(option);
    }
    

    Tweak the id, value and innerHTML to your needs.

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

Sidebar

Related Questions

I am creating a user registration form, and there is an option to select
I've created my own signup form and creating the user using the Membership class.
I am creating a form, and giving user three options. They can select only
I think creating a simple user-registration on Orchard CMS should be easy? What I
I am creating a registration form using PHP and jquery with ajax. Each field
I'm creating a user registration form and after they fill in all the information
I have such view that handles user registration. After creating new user i want
I'm currently creating a user interface using WPF and would like to display a
Is there an RFC, official standard, or template for creating a User Agent string?
I'm having trouble with cookies on my site's registration form. When a user creates

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.