Ich möchte mein Dropdown mit JSON Daten bevölkern.Popup-Dropdown von JSON-Antwort
<select id="selectSkill"><option>Choose a skill</option></select>
Ich habe json in folgendem Format:
[
{
"SkillID": "100",
"SkillName": "301 - COMCAST"
},
{
"SkillID": "36",
"SkillName": "303 - COX"
},
]
Bei normalen Arrays, ich es so tun würde:
var array= ["1", "2", "3", "4", "5"];
$.each(array, function (i, p) {
$('#selectSkill').append($('<option></option>').val(p).html(p));
Wie würde ich meine Drop-Down-bevölkern als SkillID
als Wert und SkillName
als Text meines Dropdowns setzen?
Mögliche Duplikat [Wie kann ich JSON-Daten verwenden, um die Optionen eines Auswahlfeld aufzufüllen ?] (https://stackoverflow.com/questions/5918144/how-can-i-use-json-data-populate-the-options-of-a-select-box) –