Unable to display data .
Unable to display data .
I have a Json data in this format :-
"[{"MeetingId":269,"MeetingName":"New Meeting 2","HostName":null,"ScheduledDate":"2017-10-06T05:37:00"},{"MeetingId":4305,"MeetingName":"New Meeting","HostName":"Vikash Kumar","ScheduledDate":"2017-06-20T02:35:00"}]"
what is wrong in this ?
Why i am unable to display in table ?
I am getting this error
" DataTables warning: table id=example - Ajax error. For more information about this error, please see http://datatables.net/tn/7 "
This question has an accepted answers - jump to answer
Answers
Clicking the link from the error message brings you to the specific error page. It starts with:
This error is not related to json format. It tells you the server is not responding with a HTTP 2xx response.
It is for you to figure out what exactly the server is responding with.
If you want us to figure it out, you need to provide a link to the page that is giving you this error or we will never know.
Hello HPB
This is in controller
public string UpcomingMeetings()
{
var abc = adminServiceFacade.GetUpcomingMeetingsOfAllUsers();
var dynamicObj = JsonConvert.DeserializeObject<List<AdminMeetingDTO>>(abc);
var UpCommingMeetingList =new List<UpcomingMeetingVM>();
foreach (var item in dynamicObj)
{
UpcomingMeetingVM ksj = new UpcomingMeetingVM();
ksj.HostName = item.HostName;
ksj.MeetingId = item.MeetingId;
ksj.MeetingName = item.MeetingName;
ksj.ScheduledDate = item.Schedule.ScheduledDate;
UpCommingMeetingList.Add(ksj);
}
var r = JsonConvert.SerializeObject(UpCommingMeetingList);
return r;}
In script
function UpcomingMeeting() {
$.ajax({
type: 'GET',
datatype: 'json',
url: "/Admin/Admin/UpcomingMeetings",
contentType: "application/json",
success: function (data) {
var jsonParse = JSON.parse(data);
console.log(jsonParse)
jsonObj = [];
var rt = JSON.stringify(jsonParse, null, 6);
for (key in jsonParse) {
}
Please use Markdown when posting code.
Right now you're using your own ajax function to retrieve the data and pass it to the
ajax
option. That is not the way to do it.If you want to retrieve and build the data object yourself, you should be passing it to the
data
option.If you want to use the
ajax
option, you should look at the documentation on how to use it.Thanks
I got it