I just want to fill combobox by JSON. (using jquery mobile) for example: this is my string (JSON):
var response = [{
"A":"a2",
"B":"b2",
"C":"c2"
},
{
"A":"a3",
"B":"b3",
"C":"c3"
},
{
"A":"a4",
"B":"b4",
"C":"c4"
}];
and this is my code:
...
<div>
<h1>Choose:</h1>
<select name="myDropDownA" id="myDropDownA">
<option>myOption</option>
</select>
<select name="myDropDownB" id="myDropDownB">
<option>myOption</option>
</select>
<script>
$(response.A).each(function()
{
var option = $('<option />');
option.attr('value', this.value).text(this.label);
$('#myDropDownA').append(option);
});
</script>
<INPUT type="button" value="Mybutton" onclick="Mybutton" />
</div>
I want myDropDownA to be the selecting option A, myDropDownB to be the selecting option B. and it's not working. why?