Answer the question
In order to leave comments, you need to log in
How to properly integrate 3rd party widgets and Yii2 restfull api?
There is, for example, a set of kartik-v widgets. They accept data in json in their format, for example, a choice, a separate field with a previously selected value. There is a standard option in Yii for working with restfull, which returns json in its "format". How can you, without making a crutch on both sides, most conveniently tie it all together without much labor?
Answer the question
In order to leave comments, you need to log in
JSON he and Africa JSON, he has one format everywhere. There may be a different structure of the answer - but the format is always the same. Nothing prevents you from using Yii2 to make such a structure as you need in a certain situation. On the example of the same kartik
public function actionGetData(){
Yii::$app->response->format = 'json';
return [
'output'=> $data,
'selected'=> '',
]
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question