sAjaxDataProp property set to "" (empty) but still receive an error

sAjaxDataProp property set to "" (empty) but still receive an error

jtomaszejtomasze Posts: 8Questions: 0Answers: 0
edited February 2013 in General
Hello - I have searched this forum, and the web for that matter, to not find the reason for my error. Below you will find the ajax call to my WebAPI MVC4 .NET WebAPI service. You will also find the return json object. Am I not using the sAjaxDataProp property correctly? I receive an error in the jquery.dataTables.js file. NULL error at:

var aData = _fnGetObjectDataFn( oSettings.sAjaxDataProp )( json )

$(document).ready(function () {
var oTable = $('#example').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/api/signin",
"sAjaxDataProp": "",
"aoColumns": [
{ "mData": "User_ID" },
{ "mData": "First_Name" },
{ "mData": "Last_Name" },
{ "mData": "Username" },
{ "mData": "Password" },
{ "mData": "Email_Address" }
]
});
});

JSON returned:
[{"User_ID":1,"First_Name":"xxxx","Last_Name":"xxxx","Username":"xxxx","Password":"xxxx","Email_Address":"xxxx@xxxx.com"},{"User_ID":2,"First_Name":"xxxx","Last_Name":"xxxx","Username":"xxxx","Password":"xxxx","Email_Address":"xxxx@xxxx.com"},{"User_ID":3,"First_Name":"xxxx","Last_Name":"xxxx","Username":"xxxx","Password":"xxxx","Email_Address":"xxxx@xxxx.com"},{"User_ID":4,"First_Name":"xxxx","Last_Name":"xxxx","Username":"xxxx","Password":"xxxx","Email_Address":"xxxx@xxxx.com"},{"User_ID":5,"First_Name":"xxxx","Last_Name":"xxxx","Username":"xxxx","Password":"xxxx","Email_Address":"xxxx@xxxx.com"}]

Replies

  • jtomaszejtomasze Posts: 8Questions: 0Answers: 0
    Sorry, NULL error at this line (becuase aData is NULL)
    for ( var i=0, iLen=aData.length ; i
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Its the use of both bServerSide and sAjaxDataProp:'' - that isn't possible since server-side processing needs object properties. See: http://datatables.net/forums/discussion/14245/unable-to-get-value-of-the-property-length/p1#Item_2

    And server-side processing documentation: http://datatables.net/usage/server-side

    Allan
  • jtomaszejtomasze Posts: 8Questions: 0Answers: 0
    Thank you for the response. I will look further into what you have posted here. Much appreciated.
This discussion has been closed.