sAjaxDataProp property set to "" (empty) but still receive an error
sAjaxDataProp property set to "" (empty) but still receive an error
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"}]
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"}]
This discussion has been closed.
Replies
for ( var i=0, iLen=aData.length ; i
And server-side processing documentation: http://datatables.net/usage/server-side
Allan