我希望显示来自“conta”、“zip、city、street_a、street_b”、“count、number”的数据,并从“contact”键创建一个下拉菜单,但这无处可去,有人可以吗解释这是如何工作的,这是我所拥有的。
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery</title>
<!-- script type='text/javascript' href='https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'></script -->
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
data = [
{"conta":"13356","name":"MISS Two"},
{"zip":"01111","city":"NASHUA, MA","street_a":"10 MAIN ROAD SQUARE","street_b":"Nothing"},
{"count":"544","number":"250"},
[
{"contact":"Mark Bre"},
{"contact":"Mary Lou"},
{"contact":"John Ton"},
{"contact":"Carls Des"},
{"contact":"Carlos Drt"}
]
]
$('body').append('<select id="dynamicSelect"></select>');
var options="";
$.each(data,function(i1,val1){
if($.isArray(val1)){
$.each(data,function(i2,val2){
options += "<option value="+ val2.contact +">" + val2.contact + "</option>"
});
}
}
$('#dynamicSelect').append(options);
</script>
</head>
<body>
The Select:<select id="dynamicSelect">
<option value="option value" selected="selected">option html</option>
</select>
</body>
</html>