I am trying to display data that is getting returned to me
console.log(data) shows:
{"Data":[[true,true,false],null]}
This is data that ultimately are values of 3 checkboxes.
I am not sure how to troubleshoot why I am getting
Uncaught SyntaxError: Unexpected token u
I gather that u = undefined. Could I be that I need a POST instead? I already tried not having the contentType commented out.
Clearly I have DATA coming back is the $parseJSON(data.d) an issue?
$(document).ready(function () {
jQuery.support.cors = true;
$.ajax({
url: '/GetCheckBox/3521',
type: 'GET',
dataType: 'json',
data: {},
//contentType: "application/json; charset=utf-8",
success: function (data) {
//alert(data);
console.log(data);
//WriteResponses(data);
var objdata = $.parseJSON(data.d);
WriteResponses(objdata);
},
error: function (x, y, z) {
alert(x + '\n' + y + '\n' + z);
}
});
//Displays in a Table
function WriteResponses(allNews) {
alert(allNews);
var strResult = "<table><th>Name</th><th>Student ID</th><th>Gender</th><th>Age</th>";
$.each(allNews, function (index, news) {
strResult += "<tr><td>" + news.StormOut + "</td><td> " + news.StormOut + "</td><td>" + news.StormOut + "</td><td>" + news.StormOut + "</td></tr>";
});
strResult += "</table>";
$("#divResult").html(strResult);
}
});