Javascript Ajax数据显示在表中,但不追加

Javascript Ajax数据显示在表中,但不追加,javascript,django,ajax,Javascript,Django,Ajax,我试图在不刷新页面的情况下更新我的表,这是我第一次使用ajax,所以我尝试这样做,它显示在控制台日志(我收集的数据)上,但问题是我得到的数据不会附加到我的主表中,有人能帮我吗 这是我想要更新表的dashboard.html {% load staticfiles %} <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="vie

我试图在不刷新页面的情况下更新我的表,这是我第一次使用ajax,所以我尝试这样做,它显示在控制台日志(我收集的数据)上,但问题是我得到的数据不会附加到我的主表中,有人能帮我吗

这是我想要更新表的dashboard.html

 {% load staticfiles %}
 <!doctype html>
 <html lang="en">
 <head>
   <meta charset="utf-8">
   <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
   <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
      integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">

<title>Hello, world!</title>
</head>
<body>
   <table id="_appendHere" class="table table-striped table-condensed">
          <tr>
            <th>name</th>
            <th>desc</th>
            <th>status</th>
            <th>price</th>
          </tr>
          {% for i in dest %}
             <td>{{ i.name|upper }}</td>
             <td>{{ i.desc|capfirst }}</td>
             <td>{{ i.status|capfirst }}</td>
             <td>{{ i.price | capfirst}}</td>
          </tr>
          {% endfor %}
        </table>
  <script
    src="https://code.jquery.com/jquery-3.3.1.min.js"
    integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
    crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
    integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
    crossorigin="anonymous"></script>
  <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/js/bootstrap.min.js"
    integrity="sha384-o+RDsa0aLu++PJvFqy8fFScvbHFLtbvScb8AjopnFD+iEQ7wo/CG0xlczd+2O/em"
    crossorigin="anonymous"></script>
 <script>
   function updateTable(){
   console.log("hello")
   $.ajax({
      method: "GET",
      url: "get_more_table",
      success: function(data) {
      console.log(data)
   $("#_appendHere").append(data);
    }
   })
 }
   var interval = setInterval(function () { 
   updateTable(); 
}, 10000);
</script>
</body>
</html>
{%load staticfiles%}
你好,世界!
名称
描述
地位
价格
{dest%中的i的%s}
{{i.name | upper}}
{{i.desc | capfirst}}
{{i.地位{capfirst}}
{{i.price | capfirst}}
{%endfor%}
函数updateTable(){
log(“你好”)
$.ajax({
方法:“获取”,
url:“获取更多表格”,
成功:功能(数据){
console.log(数据)
$(“#u appendHere”).append(数据);
}
})
}
var interval=setInterval(函数(){
updateTable();
}, 10000);
看法

def记录_表(请求):
dest=Destination.objects.all()
返回呈现(请求,“destination.html”,{'dest':dest})

def获取更多表格(请求):什么是“数据”?是get\u more\u table.html中的?
列表未启动。试着做出改变,让我们知道。answear mukesh keshu:是的,数据是我将从get_more_Table中获得的响应数据哦,该死,现在成功了,我犯了一个多么愚蠢的错误,谢谢什么是“数据”?是get\u more\u table.html中的?
列表未启动。试着做出改变,让我们知道。answear mukesh keshu:是的,数据是我将从get_more_table获得的响应数据哦,该死,现在可以了,我犯了一个多么愚蠢的错误,谢谢
def record_table(request):
    dest = Destination.objects.all()
    return render(request,"destination.html",{'dest':dest})

def get_more_table(request): <--- my callback table
    dest = Destination.objects.all()
    return render(request,"get_more_table.html",{'dest':dest})
          {% for i in dest %}
             <td>{{ i.name|upper }}</td>
             <td>{{ i.desc|capfirst }}</td>
             <td>{{ i.status|capfirst }}</td>
             <td>{{ i.price | capfirst}}</td>
          </tr>
          {% endfor %}