Cannot add custom parameter to aoData
Cannot add custom parameter to aoData
lezardbreton
Posts: 2Questions: 0Answers: 0
Hello,
I do not manage to add a serialized form to the parameters sent to the server via fnDraw().
Here is an extract of the code:
[code]
jQuery(function() {
var oTable;
oTable = $('#table').dataTable({
[...]
bProcessing: true,
bServerSide: true,
sAjaxSource: $('#table').data('source'),
fnServerParams: function(aoData) {
return aoData.concat($('#form').serializeArray());
},
});
[/code]
While debugging, I do see that aRet in the calling function has my custom parameters, but I get lost after that and the parameters are not sent to the server. I do not see why and I'm not very good at javascript.
Thanks!
I do not manage to add a serialized form to the parameters sent to the server via fnDraw().
Here is an extract of the code:
[code]
jQuery(function() {
var oTable;
oTable = $('#table').dataTable({
[...]
bProcessing: true,
bServerSide: true,
sAjaxSource: $('#table').data('source'),
fnServerParams: function(aoData) {
return aoData.concat($('#form').serializeArray());
},
});
[/code]
While debugging, I do see that aRet in the calling function has my custom parameters, but I get lost after that and the parameters are not sent to the server. I do not see why and I'm not very good at javascript.
Thanks!
This discussion has been closed.
Replies
[code]
var formData;
formData = $('#real_estate_ad_search').serializeArray();
return aoData.push({
name: "q[asset_type_eq]",
value: formData[1].value
}, {
name: "q[size_gteq]",
value: formData[2].value
}, {
name: "q[price_lteq]",
value: formData[3].value
}, {
name: "q[postal_code_in_any]",
value: formData[4].value
});
[/code]
Not ideal, but works for the moment. Any idea regarding what I've done wrong?