I have array in my JS and I have to parse it to PHP:
var transfer_data = {
cl_name : $("#free_1_1_title").val(),
contact_name : $("#free_1_1_name").val(),
contact_lastname : $("#free_1_1_lastname").val(),
contact_email : $("#free_1_1_email_1").val(),
cl_alley : $("#free_1_1_select_1").val(),
cl_services : $("#free_1_1_select_2").val(),
cl_tags : {
1 : $("classified_tag_1").val(),
2 : $("classified_tag_2").val(),
3 : $("classified_tag_3").val(),
4 : $("classified_tag_4").val(),
5 : $("classified_tag_5").val()
}
};
and transfering:
$.ajax({
url: "classifieds/add_new/addNewCl_1_1",
type: 'POST',
dataType: 'json',
data: transfer_data,
success: function(data) {
console.log(data.response);
},
error: function (e) {
console.log(e.message);
}
});
and I want to receive it like that:
Array
(
[cl_name] => value
[contact_name] => value
[contact_lastname] => value
[contact_email] => value
[cl_alley] => value
[cl_services] => value
[cl_tags] => array(1 => value, 2 => value...)
)
so how I should be supposed to do it? I tried to print receiving data with print_r($_POST);
and I got only
Array
(
[cl_name] => value
[contact_name] => value
[contact_lastname] => value
[contact_email] => value
[cl_alley] => value
[cl_services] => value
)
I'm missing my cl_tags
with values