码迷,mamicode.com
首页 > Web开发 > 详细

Morris ajax

时间:2015-09-15 20:20:25      阅读:263      评论:0      收藏:0      [点我收藏+]

标签:图表   ajax   

$.ajax({
    url: "ajax/some_handler.php",
    cache: false,
    type: "POST",
    data: {anyVar: ‘specialValue4PHPScriptAndDataBaseFilter‘},
    dataType: "json",
    timeout:3000,
    success : function (data) {
    //console.log(data); alert(JSON.stringify(data));

     Morris.Line({
       element: ‘TheElementName‘,
       data: data,
        xkey: ‘someID‘,
        ykeys: [‘R1‘, ‘R2‘, ‘R3‘, ‘R4‘, ‘R5‘, ‘R6‘],
        labels: [‘n1‘, ‘n2‘, ‘n3‘, ‘n4‘, ‘n5‘, ‘n6‘],
        hideHover: ‘auto‘,
        resize: true
    });
},
error : function (xmlHttpRequest, textStatus, errorThrown) {
     alert("Error " + errorThrown);
     if(textStatus===‘timeout‘)
         alert("request timed out");
} /*References: http://stackoverflow.com/questions/22746646/ajax-i-cant-get-data-from-php-by-using-json-encode*/
});


Morris ajax

标签:图表   ajax   

原文地址:http://zhaoyingyatou.blog.51cto.com/7151735/1695011

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!