I have JSON value like this:
{"223":[{"virtuemart_state_id":"1","state_name":"Alabama"},{"virtuemart_state_id":"2","state_name":"Alaska"}]}
& I am trying to parsing data like this:
<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>
But it's not working with the number 223 & I am getting error like this: SyntaxError: missing ) after argument list
Any idea in where I made mistake ? Thanks