I want to send some data to the file, and it get the file, but there no data
This is my .js code
var ids = [$(this).parent('.status-menu').prev('td').find('input').val()];
var status = $(this).find(":selected").text();
var changeStatusRKO = true;
$.ajax({
url: window.location.origin + '\partsOfPages\ajax\changeStatus.php',
type: "POST",
data: {
'ids': ids,
'status': status,
'changeStatusRKO': changeStatusRKO,
},
success: function () {
console.log('Success');
},
fail: function () {
console.log('Error');
},
})
And this is my php, where I am sending the data
<?php
print_r($_POST);
if(isset($_POST["changeStatusRKO"]) OR isset($_POST["changeStatusRegistrationBusiness"]) OR isset($_POST["changeStatusServiceOneClick"])
OR isset($_POST["changeStatusAcquiring"]) OR isset($_POST["changeStatusCashDesk"])) {
$idItem = $_POST["idItem"]; //id строки в одной из пяти таблиц (`banks_to_requests_for_XXX`); массив
// echo "print_r: "; print_r($idItem); echo "<br>";
// echo "idItem[0]: " . $idItem[0] . "<br>";
if(!isset($idItem[0]))
...
But when I send it, there are no parameter in $_POST
2
Answers
I solve this problem. I only need to change this part
to this
I removed .php in the end
Use ‘method’ instead of ‘type’. Try this:
Also, you can use your browser’s developer tools to see what’s actually being passed to the server. In Chrome, you can go to Inspect > Network tab > Click on your request > Headers tab.