Here is what is going on. I have an error in my Ajax code that is causing the following error:
Unexpected end of JSON input ajax
Here is my code:
I'm getting data from an array by doing the following:
echo json_encode($departTickets);
Then I'm parsing the JSON by doing the following:
$("[data-department-id]").click(function() {
id = $(this).attr('data-department-id');
$.ajax({
type: 'POST',
data : {
'id' : id
},
url:"/desk/template/fetchtickets.php",
success: function (res) {
var data = jQuery.parseJSON(res);
for (var jsonId in data) {
$('#department_'+id).html(jsonId);
}
}
});
});
Based on the code, what could be causing the issue?
Thank you, Kevin Davis
console.log(res)?echo 'works';and see if your are getting it inconsole.log(res);