E
E
Eugene2018-04-28 11:35:00
Yii
Eugene, 2018-04-28 11:35:00

Is it realistic to send Pjax without a button?

What is the point. I place 2 date inputs on the page to return orders for the period of time I have chosen.
Rewrote the form in Yii realities

<?= Html::beginForm(['default/stat'], 'post', ['data-pjax' => '', 'class' => 'row']); ?>
                                        <div class="col-lg-6">
                                        <?=Html::label('C', 'date') ?>
                                        <?= Html::input('date', 'string', Yii::$app->request->post('string'), ['class' => 'form-control']) ?>
                                        </div>
                                        <div class="col-lg-6">
                                        <?=Html::label('По', 'date') ?>
                                        <?= Html::input('date', 'string', Yii::$app->request->post('string'), ['class' => 'form-control']) ?>
                                        </div>
                                        <?= Html::endForm() ?>

Now I want it to return the necessary orders from the order model for the selected date for any date selection. Advised to try PJAX. And immediately I thought to just hang up the Ajax changes in js event.
On the server, it is clear that there will be processing of something like
$ordersdate = Orders::find()
->where(['between', 'date', "par1", "par2" ])->all();

But the question is, is it realistic to send date parameters to the server without a button using PJAX ?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question