When using the Image Charts API, my data is returned as undefined no matter what format it is in. The error message returned from my web service is as follows: Error Message. The purpose of the chart is to signify how many "tasks" a user has, listed by "in progress" or "completed." The server-side code is working (as far as I know, and tested by apirequest.io), and my HTML and JavaScript code seems to be correct as well. Any help is greatly appreciated, and I will have my JS code below.
let chartData = function(){
$("#history-message").html("");
$("#history-message").removeClass();
let the_serialized_data = $("#form-addtask").serialize();
console.log(the_serialized_data);
$.ajax({
url : endpoint02 + "/chartdata",
data : the_serialized_data,
method : "GET",
success : function(results){
console.log(results);
if (results = ""){
$("#img-pie-chart").hide();
$("#history-message").html("No history to display.");
$("#history-message").addClass("alert alert-info");
} else {
let inProgress = results[0]
let complete = results[1]
let imageurl = "https://image-charts.com/chart?cht=p3&chs=500x500&chd=t:"+inProgress+","+complete+"|"+inProgress+","+complete+"&chan=1000";
$("#img-pie-chart").attr("src",imageurl);
}
},
error : function(results){
console.log(results);
}
})
`}