PHP code example of nozzha / yii2-ajaxy

1. Go to this page and download the library: Download nozzha/yii2-ajaxy library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nozzha / yii2-ajaxy example snippets


if (Ajaxy::isAjaxy()) {
    return $this->renderAjax('create', $params);
}

if (Ajaxy::isSubmitted()) {
    // Handle model validation create, update or save ...
    return Ajaxy::response($status, $data);
}

Ajaxy::registerAssets($view);


$form = ActiveForm::begin([
    'enableAjaxValidation' => true, // Is up to you
    'id' => $model->formName(), // You need to set an id for the form
    'action' => ['create'] // Recommended
]);