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

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -