I try to make a post query to save my array in database. server side is PHP. My angular part:
$http({
method: 'POST',
url: "addOrder.php",
data: myJsonedArray,
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
});
Angular make a post query to addData.php, but in php file my command
print_r($_POST); or print_r($_REQUEST);
give me empty Array();
How to fix it? Thanks
UPDATE:
if I try this example in jquery - I have he same result - empty array, but if I try with "test_var" - example works well:
$.post("addOrder.php", { "test_var": da }, function (data) {
console.log(data);
});
How to make the same result? I've tried
$http({
method: 'POST',
url: "addOrder.php",
data: { "test_var": da },
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
});
but no result (
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…