Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/474.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在portlet中创建文件资源(例如JSON)的路径?_Javascript_Liferay 6 - Fatal编程技术网

Javascript 如何在portlet中创建文件资源(例如JSON)的路径?

Javascript 如何在portlet中创建文件资源(例如JSON)的路径?,javascript,liferay-6,Javascript,Liferay 6,我正在尝试在Liferay portlet中使用i18next包。初始化需要翻译文件的路径 资源的路径通常类似于js/locales/\uuuu lng\uuuu/\uuu ns\uuuu.json。(i18next包替换一些值并发出AJAX调用以获取JSON文件。) 在Liferay中,我尝试使用如上所述的简单相对路径,但没有成功 myportlet +-js +-script.js +-locales +-de +-translation.

我正在尝试在Liferay portlet中使用
i18next
包。初始化需要翻译文件的路径

资源的路径通常类似于
js/locales/\uuuu lng\uuuu/\uuu ns\uuuu.json
。(i18next包替换一些值并发出AJAX调用以获取JSON文件。)

在Liferay中,我尝试使用如上所述的简单相对路径,但没有成功

myportlet
 +-js
    +-script.js
    +-locales
       +-de
          +-translation.json
       +-en
          +-translation.json
为什么相对路径不起作用? 我可以创建一个绝对路径吗?我该怎么做