I have this simple php file which should handle an ajax request:
<?php
print_r($_POST['positionen']);
?>
If I do the request like this:
// This is the string of "myData": positionen%5B0%5D%5Bbezeichnung%5D=Anfahrt&positionen%5B0%5D%5Bmenge%5D=1&positionen%5B0%5D%5Beinheit%5D=Fahrt&positionen%5B0%5D%5Beinzelpreis%5D=10%2C00%20%E2%82%AC&positionen%5B0%5D%5Bgesamt%5D=10%2C00%20%E2%82%AC
$.ajax({
url : 'ajax/myFile.php',
type: "POST",
data: myData,
success: function (data) {
console.log(data);
}
});
I get this correct response:
Array
(
[0] => Array
(
[bezeichnung] => Anfahrt
[menge] => 1
[einheit] => Fahrt
[einzelpreis] => 10,00 €
[gesamt] => 10,00 €
)
)
Now I would like to send more data instead of only "myData". I tried this:
$.ajax({
url : 'ajax/myFile.php',
type: "POST",
data: {
myValue1: myData,
myValue2: otherData
},
success: function (data) {
console.log(data);
}
});
Andy my response looks like this:
positionen%5B0%5D%5Bbezeichnung%5D=Anfahrt&positionen%5B0%5D%5Bmenge%5D=1&positionen%5B0%5D%5Beinheit%5D=Fahrt&positionen%5B0%5D%5Beinzelpreis%5D=10%2C00%20%E2%82%AC&positionen%5B0%5D%5Bgesamt%5D=10%2C00%20%E2%82%AC