I am requesting data using ajax but it doesn’t return data in PHP 8.4 but works perfectly in PHP 7.4
The code I developed worked fine in PHP 7, once I switched to PHP 8 it didn’t work any more. I tried to add header(‘Content-Type: application/json’); in php file but still no result. here are the codes
GetQuestion(“geral”);
echo json_encode($mostrar);
break;`
}
?>
function Start(){
var codigo=$("#disciplina").val()
$.ajax({
url:'controllers/question?op=test',
type:'post',
dataType:'json',
data: {codigo:codigo},
success:function(data){
$("#perg").val(data.pergunta)
}
})
}