According to the thread here: http://datatables.net/forums/discussion/7949/getting-cannot-read-property-length-of-undefined-in-chrome-error/p1
I have the following in place in my client:
But upon running I get the following error:
If I am using data filled .txt file with the same string that is being returned from my service instead of my service then it is working fine.
Why?? What is the difference here?
I have been stuck here for 2 days now. Someone please show the way.
I have the following in place in my client:
$('#testDatatable').dataTable({ "bProcessing": true, //Works fine if Data.txt is used instead of service here "sAjaxSource": 'http://localhost:9183/Service.svc/GetCustomer', "aoColumns": [ { "mData": "Age" }, { "mData": "Name" } ] });This is what my service is returning just like datatables accept:
[OperationContract] [WebGet(ResponseFormat = WebMessageFormat.Json)] public string GetCustomer() { List<Customer> customers = new List<Customer>(); customers.Add(new Customer { Name = "Ibrahim", Age = 10 }); customers.Add(new Customer { Name = "John Doe", Age = 20}); JavaScriptSerializer js = new JavaScriptSerializer(); string returnArray = @"{ ""aaData"":"+js.Serialize(customers)+"}"; return returnArray; }
But upon running I get the following error:
Uncaught TypeError: Cannot read property 'length' of undefined
If I am using data filled .txt file with the same string that is being returned from my service instead of my service then it is working fine.
Why?? What is the difference here?
I have been stuck here for 2 days now. Someone please show the way.