Odpowiedź JSON return PHP z kodem stanu
header('Content-type: application/json');
http_response_code(200);
echo json_encode([
'message' => 'thanks'
]);
Silly Skunk
header('Content-type: application/json');
http_response_code(200);
echo json_encode([
'message' => 'thanks'
]);
//PHP File
<?php
$data = /** whatever your data are **/;
header('Content-Type: application/json; charset=utf-8');
echo json_encode($data);
//In JS File
//JQUERY AJAX
$.ajax({
url: "path/to_php_file.php",
dataType: "json",
type: "GET",
data: {datax : datax },