yii2 can not read json file into backend/web folder -
i have js file in backend/web/js/my.js
var conf = function() { return ('../conf.json'); }
but can not read conf.json file. got 403 error. problem ?
thanks anyway
you should use
var conf = function() { return ('../js/conf.json'); }
or build proper url using urlhelper
<?= 'var url_base = "' . \yii\helpers\url::base() .'";'; ?> var conf = function() { return ( url_base + '/js/conf.json'); }
Comments
Post a Comment