jQuery.post() 1.4.1 is appending [] to vars when posting from array within array
The following jquery.post is adding square brackets to each element contained in the inner array. This is causing and error binding the post data on the serverside as the syntax does not make sense. e.g. mycheckbox1[]=2&mycheckbox1[]=3.
Code snippet below... each of the data.parentGroupIds elements is getting posted with a trailing []. It does not do this in V1.3.2
function fetchProducts() {
$("#productTable").html('<table class="transparent"><tr><td><span>Fetching publications...</span></td></tr></table>');
var data = {
newspapers: $("input[name=newspapers]:checked").length == 1,
'newspaperPublishingDays.mon': $("input[name=newspaperPublishingDays.mon]:checked").length == 1,
'newspaperPublishingDays.tue': $("input[name=newspaperPublishingDays.tue]:checked").length == 1,
'newspaperPublishingDays.wed': $("input[name=newspaperPublishingDays.wed]:checked").length == 1,
'newspaperPublishingDays.thu': $("input[name=newspaperPublishingDays.thu]:checked").length == 1,
'newspaperPublishingDays.fri': $("input[name=newspaperPublishingDays.fri]:checked").length == 1,
'newspaperPublishingDays.sat': $("input[name=newspaperPublishingDays.sat]:checked").length == 1,
'newspaperPublishingDays.sun': $("input[name=newspaperPublishingDays.sun]:checked").length == 1,
periodicals: $("input[name=periodicals]:checked").length == 1
};
var parentGroupIdCheckboxes = $("input[name=parentGroupIds]:checked");
if(parentGroupIdCheckboxes.length > 0) {
data.parentGroupIds = new Array();
for (var i=0; i<parentGroupIdCheckboxes.length; i++) {
data.parentGroupIds[i] = parentGroupIdCheckboxes[i].value;
}
}
jQuery.post("productsearch.json.dhtml", data, function(json) {
var tableHtml = '<table class="transparent">';
for (var i=0; i < json.length; i++) {
tableHtml = tableHtml + '<tr><td>';
tableHtml = tableHtml + '<input name="productIds" type="checkbox" checked="true" value="' + json[i].id + '"/>\n';
tableHtml = tableHtml + '<span>' + json[i].shortDescription + '</span>';
tableHtml = tableHtml + '</td></tr>';
}
tableHtml = tableHtml + '</table>';
$("#productTable").html(tableHtml);
}, "json");
}