in my research I found that one can use this method:
$this->registerJsFile()
However, when I use it I get this error:
Calling unknown method: frontend\controllers\AvailableController::registerJs()
in my research I found that one can use this method:
$this->registerJsFile()
However, when I use it I get this error:
Calling unknown method: frontend\controllers\AvailableController::registerJs()
The method:
registerJs($url, $options = [], $key = null)
is defined in the yii2/web/View class. The $this object in your example is an instance of your AvailableController class, that presumably extends the Controller class. That's why you get the error.
You should use the $this object of one of your views.
Try to go to to your views/available folder, open a view there (for example, view.php), identify your $this object, and call registerJs() from there.