【发布时间】:2017-12-14 23:13:09
【问题描述】:
我正在开发一个 Django 应用程序,我需要在前端 (javascript) 中定义的 url 字符串中插入一个变量,以从用户的文件夹中获取一个 json 文件:
'{% static "users/ userName /file.json" %}'
我想将userName 作为变量。我需要 jstree 插件的这个 url。我必须显示用户的文件夹树:
userFolder = '{% static "users/userName/file.json" %}'
$('#jstree').jstree({
"core" : {
"animation" : 0,
"check_callback" : true,
"themes" : { "stripes" : true },
'data' : {
"url" : userFolder,
... more code ...
})
我尝试了不同的语法,但到目前为止没有运气。你知道有什么解决办法吗?
非常感谢您的帮助!
【问题讨论】:
标签: javascript python django url