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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:52:41+00:00 2026-05-16T09:52:41+00:00

like the title says, I am trying to create a drop down menu using

  • 0

like the title says, I am trying to create a drop down menu using jQuery, JSON and AJAX, although I am familiar with the theory I have yet to put it into practice, any advice, demo code snippets or tutorials would be appreciated, since I would like to get off to the best possible start!

Thanx 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-16T09:52:41+00:00Added an answer on May 16, 2026 at 9:52 am

    You need to do $.getJSON call to fetch json from server on document.load or on some other event http://api.jquery.com/jQuery.getJSON/ . After that you have to loop through the data and append it to your select box. see that http://www.jsfiddle.net/Dyc9Y/1/

    <select id="fillME"></select>
    <button id="startFilling" value="">Start ajax</button>
    $(function(){
     var json = {
                     "0":  {"title":"localjsonOPtion1", "value":"b"},
                     "1":  {"title":"localjsonOPtion2", "value":"a"}
                };
    
      $("#startFilling").click(function(){
    
        $.getJSON("http://localdev.myvouchercodes.co.uk/local/default/search/jsonresponse", function(data){
             $("#fillME").html("");
            for(key in data)
                $("#fillME").append("<option value='"+json [key].value+"'>"+json[key].title+"</option>");
            for(key in json)
                $("#fillME").append("<option value='"+json [key].value+"'>"+json[key].title+"</option>");
       });    
     });
    });
    

    offcourse above example depends on json with following format.

    { 
       "0":  {"title":"option1", "value":"1"},
       "1":  {"title":"option2", "value":"2"}
    }
    

    EDITED:
    You also need to be familiar with select box change event http://api.jquery.com/change/ and :selected selector that will allow you to fetch selected option from the selectbox
    http://api.jquery.com/selected-selector/ like $("select option:selected")

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

Sidebar

Related Questions

as the title says, I would like to create a many-to-one relationship using Fluent
Like the title says I am trying to create some regex that selects anything
Like the title says, I'm trying to determine if data is a standard attribute
So, just like the title says, I need to create an application that gets
Like the title says, I'm trying to find elements of M that exist in
As the title says, I'm trying to do something like this: public abstract class
As the title says, what I am trying to do is to have jQuery
The title pretty much says it all. I'm trying to use jQuery's ability (hoping
My question is essentially what it says in the title--I would like to create
Like my title says, I'm trying to programmatically creating an SVG image element in

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.