Div refresh .load()方法。找不到错误

时间:2019-02-26 14:05:57

标签: python refresh divide

我在Div刷新时遇到问题。 idk我的问题在哪里。并说未找到问题:/ chat /(?P5 \ d +)/(?Pchatsnr1 [\ w-] +)/ chat.html

这是我的代码

<!DOCTYPE html>
{% load static %}
<html>
    <head>
        <meta charset="utf-8">
        <title>{% block title %}kobby chat {% endblock %}</title>
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/emojionearea/3.4.1/emojionearea.css">
        <script
  src="https://code.jquery.com/jquery-2.2.4.js"
  integrity="sha256-iT6Q9iMJYuQiMWNd9lDyBUStIq/8PuOW33aOqmvFpqI="
  crossorigin="anonymous"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/emojionearea/3.4.1/emojionearea.js"></script>
        <Link rel="stylesheet" href="{% static 'chat/style.css'%}">
    </head>
    <body>
        {% include 'chat/navbar.html' %}   
        <div id="refresh" class="container-fluid">
                
            {% block content %}
            {% endblock %}
        </div> 
    
        <script type="text/javascript">
        $(document).ready(function(event){
          $("#text").emojioneArea({
                pickerPosition:"bottom "
            })
            $('#auto').load('chat.html');
            refresh();
            });
 
            function refresh()
            {
            	setTimeout( function() {
	              $('#auto').fadeOut('slow').load('chat.html').fadeIn('slow');
	                 refresh();
                	}, 5000);
            }
          
    
       
        </script>
        
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
    </body>
</html>

以及下一部分

{% extends 'chat/base.html' %}
{% block title %}{{post.title}} | {{block.super}}{% endblock %}

{% block content %}

<h3>
    {{post.title}}
</h3>
<small>Chat created by Kobby</small>
<p>{{post.body}}</p>



<form method="post">
    {% csrf_token %}
    
    <textarea id="text"  name="content" cols="40" rows="10" maxlength="160" required="" id="id_content" style="margin-top: 0px; margin-bottom: 0px; height: 35px;"></textarea>
    {% if request.user.is_authenticated %}
    <input type="submit" value="Sumbit" class="btn btn-outline-success" />
    {% else %}
        <input type="submit" value="Sumbit" class="btn btn-outline-success" disabled/>
    {% endif %}
</form>
<div id="auto" class="main-comment-section">
    
    {% include 'chat/chat.html' %}
</div>

{% endblock %}

然后确定

{{comments.count}} Chat message{{comments|pluralize}}
    {% for comment in comments %}
    
    <blockquote class="blockquote">
        <p class="mb-0">{{comment.content}}</p>
        
        {% if comment.user.is_staff  %}
        <footer class="blockquote-footer">by <cite title="Source Title" style="color:red;">{{comment.user|capfirst}}</cite></footer>
        {% else %}
        <footer class="blockquote-footer">by <cite title="Source Title">{{comment.user|capfirst}}</cite></footer>
        {% endif %}
    </blockquote>
    {% endfor %}

我认为我在使用.load()方法的网址时遇到问题,我尝试使用不同的网址,但结果相同。也许我需要其他一些方法来刷新html代码

0 个答案:

没有答案