Yii1 Ajax request how to write?

Project on Yii1.
Did this example, but why even form display does not work. Because it throws an error that the variable $input = $_POST['input'] is not defined. It's just for the test used.

Do the statistics in the admin area and wanted to tie ajax select option to display the day, month, year, all time, the very logic of sampling, working with dates and requests for the model I wrote, and update via Ajax don't know how. Can anyone have a full working example? At least to understand how it works in conjunction with yii?

in Yii2 I have done in a similar way
//views
$.ajax({
 url: '<?php echo Yii::$app--->request->baseUrl. '/controller/Some' ?>',
 type: 'post',
 data: {
 someValue: $("#someValue").val() , 
 _csrf : '<?=Yii::$app--->request->getCsrfToken()?>'
},
 success: function (data) {
console.log(data.result);
}
 });


//controller
public function actionSome()
{
if (Yii::$app->request->isAjax) {
 $data = Yii::$app->request->post();
 // extracts from the request data and perform logic and prepare response
 $result = //reply
 \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
 return [
 'result' => $result,
 'code' => 100,
];
}
}


actually the documentation I polistil, anything intelligible did not find.In Yii1 this is done some other way ?
July 9th 19 at 13:09
0 answer

Find more questions by tags AJAXYii