Javascript:如何在Ajax或Json中发送多个数据

时间:2016-11-18 16:19:16

标签: javascript jquery json ajax

对不起,但我很困惑,如果它真的是AJAX或JSON,我不擅长这种语言。 但我的问题是发送2个列表框值。年和月。这一年发送到 <script type="text/javascript"> $(document).ready(function() { //default getAjaxData(new Date().getFullYear()); $('.dynamic_data').change(function() { var id = $('#year').val(); var id2 = $('#month').val(); getAjaxData(id); }); var options = { chart: { renderTo: 'container', type: 'column' }, title: { text: 'Highcharts Chart PHP with MySQL Example', x: -20 //center }, subtitle: { text: 'Subtitle', x: -20 }, xAxis: { categories: [] }, yAxis: { title: { text: 'TOTAL' }, plotLines: [{ value: 0, width: 1, color: '#808080' }] }, tooltip: { headerFormat: '<span style="font-size:11px">{series.name}</span><br>', pointFormat: '<span style="color:{point.color}">{point.name}</span>:<b>{point.y}</b> of total<br/>' }, plotOptions: { series: { borderWidth: 0, dataLabels: { enabled: true, format: '{point.y}' } } }, legend: { layout: 'vertical', align: 'right', verticalAlign: 'top', x: -40, y: 100, floating: true, borderWidth: 1, shadow: true }, series: [] }; function getAjaxData(id) { $.getJSON("data-basic-colm-ajax.php", {id:id}, function(json) { options.xAxis.categories = json[0]['data']; //xAxis: {categories: []} options.series[0] = json[1]; chart = new Highcharts.Chart(options); }); } }); </script> <script src="/MyCharts/highcharts/js/highcharts.js"></script> </head> <body> <a class="link_header" href="/highcharts/">&lt;&lt; Back to index</a> <div class="menu_top" > Year: <select class="dynamic_data" id="year"> <option value="2016" >2016</option> <option value="2015">2015</option> <option value="2011">2011</option> </select> Month: <select id="month"> <option value="1" selected>Jan</option> <option value="2">Feb</option> <option value="3">Mar</option> </select> </div> <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto;"></div> </body> ,但我不知道如何发送月份

这是我的代码:

dev.off()

谢谢

1 个答案:

答案 0 :(得分:0)

我只是将我的代码更改为

         try {
        MP3File musicFile = (MP3File) AudioFileIO.read(SourceFile);

        if (musicFile != null && musicFile.hasID3v2Tag()) {
            ID3v23Frame frame = (ID3v23Frame) musicFile.getID3v2Tag().getFrame(ID3v24Frames.FRAME_ID_POPULARIMETER);
            FrameBodyPOPM body = (FrameBodyPOPM) frame.getBody();
            String mail = body.getEmailToUser();
            Long irating = body.getRating();
            Long cnt = body.getCounter();
        }
    } catch (CannotReadException | IOException | TagException
            | ReadOnlyFileException | InvalidAudioFrameException e5) {
        throw e5;
    }