I want to send as ajax request with array(which can be any length) as 1 parameter, something like :
mandatoryFields = [];
for (i = 1; i <= post_type_max_elements; i++) {
    ...
    var mandatoryItem = []
    mandatoryItem['optionName'] = optionName;
    mandatoryItem['optionValue'] = optionValue;
}
var data = {
    action: 'update_mandatory_fields',
    post_type: select_post_type,
    mandatoryFields: mandatoryFields
};
jQuery.ajax({
    type: 'POST',
    dataType: "json",
    data: data,
    ...
Seems, that this not work, as on server parameter mandatoryFields is not defined. Which is the best way?
Thanks!
 
     
    