开发者

django extends + jquery some problem

开发者 https://www.devze.com 2023-04-04 20:56 出处:网络
I have a problem with my .js scripts in the site which is a child of the base.html. The scripts which are located in the base.html work, there is no problem with them, but those which are located in

I have a problem with my .js scripts in the site which is a child of the base.html.

The scripts which are located in the base.html work, there is no problem with them, but those which are located in the "child site" don't want to work at all:p

Best regards, nykon

PS, the child page:

{% extends 'index.html' %}

{% block content-left %}
<script src="media/js/test.js"></script>

<form action="" method="post">{% csrf_token %}
   <table>
{% for item in form %}
<tr>
  <td><span class="form_label">{{item.label}}</span></td>
  <td><span class="form_item">{{item}}</span></td>
</tr>
{% endfor %}
</table>
  <input ty开发者_运维百科pe="submit" value="Add">
</form>
{% endblock %}


The script's src is incorrect. It should be an absolute path, either src="/media…" or, more likely, src="{{ MEDIA_URL }}js/test.js".

0

精彩评论

暂无评论...
验证码 换一张
取 消