<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'index.jsp' starting page</title>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/highcharts.js"></script>
<script type="text/javascript" src="js/exporting.js"></script>
<script type="text/javascript">
$(function (){
$.ajax({
            type: "post",
            dataType: "json",
            url: "execute.do",
            async:true,
            success: function (data) {
            alert("成功");
                var str = "";
                for (i in data) {
                 $(function () {
                 $('#chartdiv').highcharts({
                 title: {
text:"学生信息展示",
x:-20
},subtitle:{
text:"这边是副标题",
x:-20
},xAxis:{
categories: [data[i].stuname]
},yAxis:{
title: {
text: '纵轴单位(分)'
},plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},tooltip: {
valueSuffix: '名' //tips单位
},legend: {
layout: 'vertical', //图例样式
align: 'right', //图例位置(居右)
verticalAlign: 'bottom', //图例对齐方式
borderWidth: 1
},series: [{
name: '编号',
data: [data[i].stuid]
},{
name: '成绩',
data:[data[i].scores]
}]
});
});
                }
            }, error: function ( data ) {
                alert("失败");
            }
        });
    });
</script>
</head> <body>
<div id="chartdiv"></div>
</body>
</html>我这样的话只能获取1条数据 实际上alert他的长度是查询出来了10条
jquery ajaxjsonjspjavascripthighcharts