4
jQuery를 사용하여 AJAX 쿼리를 실행하고 싶지만 응답이 원하는 것이 아닙니다.Yii2 및 Ajax : 응답이 SQL 쿼리 결과가 아닙니다.
클라이언트 측 :
$.ajax({
url: "/family?idperson=1234",
dataType: 'json',
success: function(res) {
console.log(JSON.stringify(res, null, 4));
},
error: function(err) {
}
});
서버 측 :
public function actionFamily($idperson)
{
$searchModelFamily = new FamilySearch();
$dataProvider = $searchModelFamily->searchByIdperson(Yii::$app->request->queryParams, $idperson); // This database query works great.
Yii::$app->response->format = Response::FORMAT_JSON;
return $dataProvider;
}
이는 JSON 객체의 컨텐츠입니다 : 그것은 SQL 쿼리의 일부에 보인다. 하지만 SQL 결과이 필요합니다.
{
"query": {
"sql": null,
"on": null,
"joinWith": null,
"select": null,
"selectOption": null,
"distinct": null,
"from": null,
"groupBy": null,
"join": null,
"having": null,
"union": null,
"params": [],
"where": {
"idperson": "1234"
},
"limit": null,
"offset": null,
"orderBy": null,
"indexBy": null,
"emulateExecution": false,
"modelClass": "app\\models\\Family",
"with": null,
"asArray": null,
"multiple": null,
"primaryModel": null,
"link": null,
"via": null,
"inverseOf": null
},
"key": null,
"db": null,
"id": null
}
현재 결과는 무엇이며 원하는 결과는 무엇입니까? –