attempting to use asp.net page method yet returning strange json
attempting to use asp.net page method yet returning strange json
I'm using an asp.net page method as the sAjasSource, along with fnServerData,
and while I'm able to get as far as returning data, what comes back is looking weird.
[code]{"d":{"__type":"MyApp.Project_grid+ReturnType_Project_grid",
"sEcho":[{"sEcho":"1"}],"iTotalRecords":[{"iTotalRecords":"100"}],"iTotalDisplayRecords":[{"iTotalDisplayRecords":"25"}],
"aaData":[
{"CarID":"77681597","WheelID":"2630678","State":"NJ","County":"Mercer",
{"CarID":"77681598","WheelID":"2630679","State":"NJ","County":"Camden"}
]
}}[/code]
I've tried to scour the net, but can't seem to find an end-to-end example
of using datatables with a pagemethod.
and while I'm able to get as far as returning data, what comes back is looking weird.
[code]{"d":{"__type":"MyApp.Project_grid+ReturnType_Project_grid",
"sEcho":[{"sEcho":"1"}],"iTotalRecords":[{"iTotalRecords":"100"}],"iTotalDisplayRecords":[{"iTotalDisplayRecords":"25"}],
"aaData":[
{"CarID":"77681597","WheelID":"2630678","State":"NJ","County":"Mercer",
{"CarID":"77681598","WheelID":"2630679","State":"NJ","County":"Camden"}
]
}}[/code]
I've tried to scour the net, but can't seem to find an end-to-end example
of using datatables with a pagemethod.
This discussion has been closed.
Replies
This seemed to get things working, though:
[code]fnCallback( jQuery.parseJSON( '{ "sEcho" : ' + parseInt(result.d.sEcho[0]["sEcho"]) + ', "iTotalRecords": ' + JSON.stringify(result.d.iTotalRecords[0]["iTotalRecords"]) + ', "iTotalDisplayRecords": ' + JSON.stringify(result.d.iTotalDisplayRecords[0]["iTotalDisplayRecords"]) + ', "aaData" : ' + JSON.stringify(result.d.aaData) + '}') )[/code]
Allan