I send an array / object mix to Php but the POST is empty
console.log (data)
data:
ABONNR: 900000064
UMO301NR: 173088
change:
assistant: [phone: Array(0)]
patient: [phone: {…}, social: "single"]
patient-medical: "Hoge bloeddruk"
patient-name: "Burger Maria SENSO2ME"
remove:
assistant: [{…}, phone: Array(0)]
patient: [phone: Array(0)]
patient-medical: "Evenwichtsproblemen"
Jquery
var json = {data:changed}
console.log(json)
$.ajax({
url: Settings.base_url + '/home/update',
data: json,
type: 'post',
success: function (response) {
console.log(response)
}
});
Php print_r($_POST)
Array ( )
Do you have an idea ?
Thx!
2
Answers
$_POST[] will not grab
JSON
. You should use file_get_contents() instead.similar answer there: How to get body of a POST in php?