There are two ajax submission methods:
The first one:
Form part
<?php $form = ActiveForm::begin([ 'id' => $model->formName(), 'action' => ['/apitools/default/index'] ]); ?>
(Related tutorial recommendations:yii framework)
ajax part
Second type (if you use JsBlock, you can also write like this):
For more programming related content, please pay attention to the Programming Introduction column on the php Chinese website!
The above is the detailed content of How to submit ajax in yii2. For more information, please follow other related articles on the PHP Chinese website!