Py学习  »  Django

如何在html中使用django和js中的变量?

Benjamin Donnaloia • 3 年前 • 1270 次点击  
  for (var i = 0; i < input.files.length; ++i) {
      selected_files.push(input.files.item(i))
      children += '<form id=${input.files.item(i).name}-edit-form action={% url 'asset-batch-update' %} method="POST">';
  }

如代码片段最后一行所示,将这些js变量和django变量放入html的正确方法是什么。

我试图使用${input.files.item(I).name}作为js变量,{%url'producer:asset batch update'application.client_id%}是django变量,但我不确定是否需要用另一对引号括起来?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/129953
 
1270 次点击  
文章 [ 1 ]  |  最新文章 3 年前