how to include needed files in view

hello all,

This is a simple question but i cant find a solution,

for example

i want to use the kartik dialog in my js file

in my view i did put

use kartik\dialog\DialogAsset;

DialogAsset::register($this);

when i call it from the inside the js file(inside the document ready part from jquery)

like

KrajeeDialog.alert("Hold On! This is a Krajee alert!");

i got

TypeError: KrajeeDialog.alert is not a function

how can i resolve this.

thx in advance

Searching in doc:

http://demos.krajee.com/dialog

I see that you have to call:




krajeeDialog.alert("Hold On! This is a Krajee alert!");



i used that to but then i got

ReferenceError: krajeeDialog is not defined

thats why i think some files are not loaded(js,css,…)

if i watch the loaded js files in firebug the dialog.js is loaded

start of file


/*!

  • @package yii2-dialog

  • @author Kartik Visweswaran <kartikv2@gmail.com>

  • @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014 - 2016

  • @version 1.0.0

Just put the following code before calling the alert method.

echo Dialog::widget();

1 Like

Thx for answering my question, I did forgot about this question. It will serve for others who have the same problem.