I have the following code which gets an array of names and values from a json request and appends them to a select item in a html page.
It works for me so far in all browsers except IE in which instead of the expect result
<option value="211">Bakery and Cafe</option>
I get a result
<option value="211"/>
Javascript:
$.getJSON(link,function(data) {
$('#CltOrgType').find('option').remove().end();
for (key in data){
alert(data[key][0],data[key][1]);
var option = new Option(data[key][0],data[key][1],false,false);
$('#CltOrgType').append(option);
}
});
The JSON response looks like the following
[[ "Asian Cuisine" , "200" ], [ "Bakery and Cafe" , "211" ], [ "Breakfast, Lunch & Snacks" , "215" ], [ "Cafe" , "195" ], [ "Fully Licensed Restuarant" , "205" ], [ "Japanese Cuisine" , "210" ], [ "Licensed Italian Cuisine" , "206" ], [ "Middle Eastern Cuisine" , "209" ], [ "Pizza Restaurant" , "199" ], [ "Salads, Soups & Sandwiches" , "213" ], [ "Sandwiches and Wraps" , "207" ], [ "Sushi" , "214" ], [ "Take Away" , "208" ], [ "Yoghurt and Salads" , "212" ]]
and all browsers display the correct information with console.log(data[key][0] +","+data[key][1]) or alert(data[key][0] +","+data[key][1])
Any ideas, solutions or thoughts would be highly appreciated! As this ones got me stuck for a while