Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

122
Views
Want to show show content of particular key in the dropdown form

I created a from where I need to take state and city or District from the user and I have Json file of all the information. I successfully able to fetch the Sates from that JSON file

  <label for="state">State</label>
   <select name="state" id="state">
   <option value="" selected="true" disabled="true">Select your State</option>
   </select>
 <label for="District">District</label>
         <select name="District" id="district">
            <option value="" selected="true" disabled="true">Select your district</option>
         </select>
<script>
$(document).ready(function(){
    var obj = "places.json";
    let data;
     $.getJSON(obj, function (info) {
         data=info;
        $.each(data, function (index, value) {
            $('#state').append('<option value="' + index + '">' + value.state + 
    '</option>');
      }); 
     });
});
</script>

JSON File content

{  
         "state":"Delhi (NCT)",
         "districts":[  
            "Central Delhi",
            "East Delhi",
   
         ]
      },
      {  
         "state":"Goa",
         "districts":[  
            "North Goa",
            "South Goa"
         ]
      },

What I want when user Select particular state from the dropdown box. then in the district all the districts of that particular state will display there is this possible to do

I try the same way to fetch the districts from the JSON but in drop down i am getting all districts of every state in object. What I want when user Select particular state from the dropdown box. then in the district dropdown all the districts of that particular state will display. Is this possible to do. Suppose I select Goa all districts of goa show in dropdown

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!