JavaScript in Yii2
Contents
Script file in layout, (*1)
Script file in view, (*2)
Inner script in view, (*3)
Simple js widget in view, (*4)
Simple loading html content using ajax, (*5)
Passing data from server in json format, (*6)
Simple pjax with forms and links, (*7)
CRUD grid with ajax and modal windows, (*8)
Installation
-
Install the application via composer using the following commands:, (*9)
composer global require "fxp/composer-asset-plugin:*"
, (*10)
composer create-project --prefer-dist --stability=dev vkabachenko/yii2-js yii2-js
, (*11)
cd yii2-js
, (*12)
-
Create a new database and adjust the components['db']
configuration in config/web.php
file., (*13)
-
Apply migrations with console command yii migrate
. This will create tables needed for the application to work., (*14)
-
Now you should be able to access the application through the following URL:, (*15)
http://localhost/yii2-js/web/
, (*16)