前端之家收集整理的这篇文章主要介绍了
Morris 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("requesttimedout");
}/*References:http://stackoverflow.com/questions/22746646/ajax-i-cant-get-data-from-PHP-by-using-json-encode*/
});
原文链接:https://www.f2er.com/ajax/162907.html