Access to XMLHttpRequest at 'https://becompact.ru/upload/iblock/c4b/c4b7bf4a1ea...' from origin 'https://local.test' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
<?php if ($last_item_index==$index) { ?>
<?php if ($last_item_index==$key) { ?>
SET NAMES UTF-8
function isTheseParametersAvailable($params){
//assuming all parameters are available
$missingparams = array();
foreach($params as $param){
if(!isset($_POST[$param]) || !strlen($_POST[$param]))
$missingparams[] = $param;
}
if(count($missingparams)){
$response['error'] = true;
$response['message'] = 'Parameters ' . implode(", ", $missingparams) . ' missing';
exit(json_encode($response));
}
}
куки снова записываются для всех страниц
//... session_destroy(); Setcookie("user_id",$_SESSION['user_id'],time()-3600000); //...
<form id="addpro" method="POST" action="procces.php">
<input type="hidden" name="id" value="234">
<input type="hidden" name="redirect" value="https://site.com">
<input type="submit" value="Button">
<input type="hidden" name="id" value="234">
</form>
//что-то делаем....
header("location: ".$_POST['redirect']);
$("form#addpro").submit(function(){
var formData = new FormData(this);
$.ajax({
url: 'procces.php',
type: 'POST',
data: formData,
async: false,
success: function (data) {
alert(data)
},
cache: false,
contentType: false,
processData: false
});
return false;
});