JS怎么从数据库中请求数据

JS如何从数据库中请求数据?
下面这个用于作图的JS程序可以运行成功。但我想将其中的数据:quantity和per 替换成从数据库中读取。
通过摸索终于弄懂了highstock这个JS文件的参数含义,使用样例数据顺利的得到图形。但就是卡在把样例数据替换成读取数据库里头的数据这一关上。分数不多了,还请各位大侠指点一下


<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">  
<title>MyStock</title>  

</head>  
  <body>
   <div id="container" style="height: 600px; min-width: 400px"></div>
  </body>
  <script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
  <script type="text/javascript" src="js/highstock.js"></script>


  <script type="text/javascript">
  var quantity=[
[1190678400000,66281],
[1190764800000,44556],
[1190851200000,32271],
[1190937600000,39246],
[1191196800000,129354],
[1191283200000,53124],
[1191369600000,37885],
[1191456000000,83500],
[1191542400000,91903],
[1191801600000,105989]
                ]; 

  var per=[
[1190678400000,0.6763],
[1190764800000,0.6738],
[1190851200000,0.6753],
[1190937600000,0.6759],
[1191196800000,0.674],
[1191283200000,0.6744],
[1191369600000,0.687],
[1191456000000,0.6983],
[1191542400000,0.696],
[1191801600000,0.6945]
         ];

  $(function () {
    $('#container').highcharts('StockChart',{
        chart: {
            type:'spline'
        },
        title: {
            text: '销量与收益率关系'
        },
        subtitle: {
            text: 'Source: Dawugui.com'
        },
        
        
       /*  xAxis: [{
        
         categories: usdeur
  
        }], */
        
        plotOptions:{   //设置线条粗细
         series:{
         lineWidth:0.5
         }
        },
        
        yAxis: [{ // Primary yAxis
            title: {
                text: '比率',
                style: {
                    color: Highcharts.getOptions().colors[4]
                }
            },
            
            //设置区分线
            plotLines: [{
     value: 0.725,
     width: 1.5,
     color: 'red'
     }],
            
            labels: {
                format: '{value}',
                style: {
                    color: Highcharts.getOptions().colors[4]
                }
            },
            opposite: true
        }, 
        
        
        
        { // Second yAxis
            gridLineWidth: 0,
            title: {
                text: '销量',