我JSON值是這樣的:jQuery的parseJSON幫助的SyntaxError
{"223":[{"virtuemart_state_id":"1","state_name":"Alabama"},{"virtuemart_state_id":"2","state_name":"Alaska"}]}
&我試圖解析的數據是這樣的:
<script type="text/javascript" src="jquery-1.11.1.min.js"></script>
<script type="text/javascript">
$("document").ready(function() {
var state,
url = 'http://localhost/jquery/test.json';
$.getJSON(url, function(data){
console.log(data);
$.each(data.223, function(i, rep){
state += "<option value = '" + rep.virtuemart_state_id + "'>" + rep.state_name + "</option>";
});
$("#state").html(state);
});
});
</script>
</head>
<div id="result">
<select id="state">
</select>
</div>
但它不是我的號碼223 &工作得到像這樣的錯誤:SyntaxError: missing) after argument list
任何想法在哪裏我犯了錯誤?謝謝