die retorno json_encode es nichts zurückkehr
ist dies die js Controller ich möchte die json „retorno“
$.ajax({
url: 'controll/busqueda.php',
data: {
format: 'json',
"precio_min": "",
"precio_max": "",
"rate": "",
"asignatura": ""
},
success: function(retorno) {
alert(retorno.profesores);
},
error: function() {
alert("aaaaa");
},
type: 'GET'
});
dies ist die PHP-Datei, wo ich zurückkehren das Modell db nennen und $ retorno ist ein stdClass() aus der Datenbank, wo ich in ihnen profesores
if($precio_max != "" || $precio_min != ""){
$retorno = $busqueda->profesor_precio($precio_min,$precio_max);
}else{
if($rate != ""){
$retorno = $busqueda->profesor_rate($rate);
}else{
if($asignatura != ""){
$retorno = $busqueda->profesor_asig($asignatura);
}else{
$retorno = $busqueda->profesor();
}
}
}
echo json_encode($retorno, true);
Haben Sie die AJAX-Anfrage/-Antwort in den Entwicklertools Ihres Browsers gesehen? –
oh und das Ergebnis von retorno.profesores ist immer undefiniert und es sollte und Array –
Also - es ist nicht Ihre AJAX, es ist Ihre PHP, die nicht funktioniert. –