jquery遍歷1:
javascript
<script type="text/javascript"> var d1 =[{"text":"王家灣","value":"9"},{"text":"李家灣","value":"10"},{"text":"邵家灣","value":"13"}]; $(d1).each(function(){ alert(this.text+" "+this.value); }); </script>
jquery遍歷2:html
$.each(jsonObj,function(index,item){ alert(index+"=="+item.url); });
普通的數組遍歷java
<script type="text/javascript"> var json = {"options":"[{\"text\":\"王家灣\",\"value\":\"9\"},{\"text\":\"李家灣\",\"value\":\"10\"},{\"text\":\"邵家灣\",\"value\":\"13\"}]"} json = eval(json.options) for(var i=0; i<json.length; i++) { alert(json[i].text+" " + json[i].value) } </script>