Click here to Skip to main content
15,936,802 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I cant read the json file date to populate the dynamic dropdown list

What I have tried:

          <label for="people">People: </label>
           <select id="people" ></select>

          <script type="text/JavaScript">

       $select = $('#people');

        url:   "http://localhost:58421/jsonfiles/person.json",
        dataType: 'JSON',
        success: function (data) {
           $.each(data.person, function(key, val){
           $select.append('<option id="' + + '">' + + '</option>');
           error: function () {
           $select.html('<option id="-1">none available</option>');

person": [
    "id": "1",
    "name": "Person1"
    "id": "2",
    "name": "Person2"
    "id": "3",
    "name": "Person3"
Dennis E White 23-Aug-18 10:08am    
have you even tried to google this yourself?? I did a quick google and came up with several examples.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900