$(function () {
$('#datetimepicker1').datetimepicker(
{format: 'DD.MM.YYYY', locale: 'ru'}
);
$('#datetimepicker1').on("dp.change", function ()
{
var bes = $(".form-control").val()
$.ajax(
{
url:window.location,
data: {a:bes},
type: 'POST',
success: function (res) {
console.log(res);
},
error:function () {
alert('Error');
}
}
);
});
});
class CategoryController extends Controller
{
public function actionViewdoc($id=null)
{
$id = Yii::$app->request->get('id');
if (Yii::$app->request->isAjax && Yii::$app->request->isPost)
{
$carddoc = Yii::$app->request->post('a');
return Cards::find()->where(['doctor_id' =>$id],['data' =>$carddoc)->asArray()->all();
}
$doc = Doctor::find()->where(['id' =>$id])->asArray()->all();
return $this->render('viewdoc' ,compact('doc'));
}
}
if (Yii::$app->request->isAjax && Yii::$app->request->isPost) {
$carddoc = Yii::$app->request->post('a');
$cards = Cards::find()->where(['doctor_id' => $id, 'data' => $carddoc])->asArray()->all();
return $this->asJson($cards);
}