我想问当SQL的ajax结果中的空值和0值时如何显示错误消息
{"value":
{"columns": [["More than 85%",null],["Less than 85%",0]],
"type":"pie"}
}
否则不显示弹出消息。
$.ajax({
type: "POST",
url: "charts/prod.php?year=" + $("#selectyear").val() + "&month=" + $("#selectmonth").val(),
dataType: "json",
success: function (result) {
var chart = c3.generate({
bindto: '#piepie',
data: result.value,
color: {
pattern: ['#f35213', '#f1af4c']
},
pie: { title: "Productivity", }
});
},
error: function() {
if ((result == null) && (result == 0)){
alert ('Data are not ready yet!!');
}
else {
('error');
}
}
});