aoData is null
aoData is null
Hi all,
What I am trying to do, is pass a param to my webservice (which in the bad old days would have been something like server.com/blah.ext?param=value) Seems I need to use fnServerData and insert an object and push it onto aoData - right? Basically, during initialisation, I have this:
[code]
oTableHistory = $j('#table_history').dataTable( {
"sAjaxSource": "/Report_WS.asmx/GetCustomerDocumentHistoryJSON"
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push( { "something": myvalue } );
$.getJSON( sSource, aoData, function (json) {
fnCallback(json)
} );
},
[/code]
It's the aoData.push which fails because aoData is null. Debugging I can see that the aoData buried somewhere in oSettings is an object (i.e. valid) but not here in this context.
I should point out, this is a second dataTable on this page - but I'm pretty sure there are no "clashes" (and besides, the first is functioning fine).
any help much appreciated!
ruzz
What I am trying to do, is pass a param to my webservice (which in the bad old days would have been something like server.com/blah.ext?param=value) Seems I need to use fnServerData and insert an object and push it onto aoData - right? Basically, during initialisation, I have this:
[code]
oTableHistory = $j('#table_history').dataTable( {
"sAjaxSource": "/Report_WS.asmx/GetCustomerDocumentHistoryJSON"
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push( { "something": myvalue } );
$.getJSON( sSource, aoData, function (json) {
fnCallback(json)
} );
},
[/code]
It's the aoData.push which fails because aoData is null. Debugging I can see that the aoData buried somewhere in oSettings is an object (i.e. valid) but not here in this context.
I should point out, this is a second dataTable on this page - but I'm pretty sure there are no "clashes" (and besides, the first is functioning fine).
any help much appreciated!
ruzz
This discussion has been closed.
Replies
[code]
oTableHistory = $j('#table_history').dataTable( {
"sAjaxSource": "/Report_WS.asmx/GetCustomerDocumentHistoryJSON"
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.getJSON( sSource, [ {"name": "something", "value": "myvalue"} ], function (json) {
fnCallback(json)
} );
},
[/code]
or you can change the line in DataTables:
[code]
oSettings.fnServerData.call( oSettings.oInstance, oSettings.sAjaxSource, null, function(json) {
[/code]
to
[code]
oSettings.fnServerData.call( oSettings.oInstance, oSettings.sAjaxSource, [], function(json) {
[/code]
Allan
However, it didn't work. Here's the code now:
[code]
"fnServerData": function ( sSource, aoData, fnCallback ) {
$j.getJSON( sSource, [{ "customerDocumentTfsId" : "1v1" }], function (json) {
fnCallback(json)
} );
[/code]
Firebug says:
http://127.0.0.1/Report_WS.asmx/GetCustomerDocumentHistoryJSON?undefined=undefined
and, trimming off the fat from the FB Response tab: Missing parameter: customerDocumentTfsId
Any ideas?
TIA
ruzz
[{"name" : "customerDocumentTfsId", "value" : "1v1" }]
and NOT
[{"customerDocumentTfsId" : "1v1" }]
Solved! Thanks again Allan.
ruzz