Problem to add some extra data to the sender
Problem to add some extra data to the sender
tohidazizi
Posts: 3Questions: 0Answers: 0
I need to pass extra data to my web service. So I've written the following code:
[code]
$(function () {
$('#tblSites').dataTable({
"bJQueryUI": true,
"aLengthMenu": [[10, 25, 50, 200, -1], [10, 25, 50, 200, "All"]],
"bSort": false,
"bFilter": true,
"bPaginate": true,
"sPaginationType": "full_numbers",
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/Controller/GetSiteList/?cohortId=1",
"fnServerData": function (sSource, aoData, fnCallback) {
aoData.push({"siteId":"1", "siteStatus":"active"});
$.ajax({
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
});
}
});
});
[/code]
It doesn't pass my parameters (siteID and siteStatus).
When I check the POST query (using Firebug 1.6.2), it seems that the function just adds "undefined=undefined" to the end of it! See:
sEcho=1&iColumns=6&sColumns=&iDisplayStart=0&iDisplayLength=10&sSearch=&bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&sSearch_1=&bRegex_1=false&bSearchable_1=true&sSearch_2=&bRegex_2=false&bSearchable_2=true&sSearch_3=&bRegex_3=false&bSearchable_3=true&sSearch_4=&bRegex_4=false&bSearchable_4=true&sSearch_5=&bRegex_5=false&bSearchable_5=true&undefined=undefined
Any solution?
[code]
$(function () {
$('#tblSites').dataTable({
"bJQueryUI": true,
"aLengthMenu": [[10, 25, 50, 200, -1], [10, 25, 50, 200, "All"]],
"bSort": false,
"bFilter": true,
"bPaginate": true,
"sPaginationType": "full_numbers",
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/Controller/GetSiteList/?cohortId=1",
"fnServerData": function (sSource, aoData, fnCallback) {
aoData.push({"siteId":"1", "siteStatus":"active"});
$.ajax({
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
});
}
});
});
[/code]
It doesn't pass my parameters (siteID and siteStatus).
When I check the POST query (using Firebug 1.6.2), it seems that the function just adds "undefined=undefined" to the end of it! See:
sEcho=1&iColumns=6&sColumns=&iDisplayStart=0&iDisplayLength=10&sSearch=&bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&sSearch_1=&bRegex_1=false&bSearchable_1=true&sSearch_2=&bRegex_2=false&bSearchable_2=true&sSearch_3=&bRegex_3=false&bSearchable_3=true&sSearch_4=&bRegex_4=false&bSearchable_4=true&sSearch_5=&bRegex_5=false&bSearchable_5=true&undefined=undefined
Any solution?
This discussion has been closed.
Replies
[code]
aoData.push({"name":"siteID", "value":"1"});
aoData.push({"name":"siteStatus", "value":"active"});
[/code]