我需要加载一个文件到一个函数,以便与电话自动成形库一起使用(Intl tel input) 当我在独立的html页面中尝试这个时,它工作正常,但是当我试图在django项目中做到这一点,文件只是不加载,我认为这是因为它没有找到它在路径中的位置。参考django javascript文件中的其他静态文件
main.js和utils.js都在我的项目的静态目录中,所以我不知道它为什么找不到utils.js文件。
main.js:
$(document).ready(function() {
$("#phoneNumber").intlTelInput({
utilsScript: "utils.js"
});
});
看看[this](https://github.com/tstone/django-uploadify/blob/master/uploadify/templates/uploadify/multi_file_upload.html)示例适用于您。 –
你也可以尝试[这](http://stackoverflow.com/questions/11396457/how-to-make-static-url-work-in-external-js-files-django/11396683#11396683)选项。除了{%static'your_js_here.js'%}' –
@DejaVu在第一个例子中,它如何知道'upload_path'和'uploadify_path'是什么? – rasen58