Answer the question
In order to leave comments, you need to log in
Php doesn't see $_POST['data'] passed by ajax?
I can’t understand why the post-array is lost during the transfer.. help me figure it out
var data = {
action: "edit_servise",
servise_id : servise_id,
current_servise_key : current_servise_key,
current_servise_label : current_servise_label,
current_servise_cost : current_servise_cost,
upd_servise_label : upd_servise_label,
upd_servise_cost : upd_servise_cost
};
jQuery.post( ajaxurl, data, function(response) {
console.log('Получено с сервера: ' + response);
});
if(isset($_POST['data']) ) {
$data = $_POST['data'];
echo $data['servise_id'];
}
else {echo 'не пришло';}
Answer the question
In order to leave comments, you need to log in
So you don't pass $_POST['data']. Do a var_dump($_POST) and see what comes up.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question