首页 > Web开发 > 详细

Morris ajax

时间:2015-09-15 20:18:24      阅读:446      评论:0      收藏:0      [点我收藏+]
$.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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!