title: Reload the table without refreshing the page in Django
body: <p>Have small table that needs to be updated every 10 seconds with new data. Entire website is working in Django. JSON is parsing data into 1 table and rewriting the data every 10 seconds in database. The website is showing the data from the database. The procedure I need is to refresh the front-end table with new data every 10 seconds - it would be the AJAX I assume, can you help me write the code for it? It would not append data to the table, just keep refreshing it.</p>
  
  <p>Example - The table in the database has fixed 10 rows of data and it is being refreshed by JSON. The front-end would always show 10 rows, so every 10 seconds, the table (front-end) would always show 10 rows with the new data.</p>
  
  <p>Django version 1.11</p>
  
  <p>Here are the python files</p>
  
  <h1>views.py</h1>
  
  <pre><code>def prices(request):
      prices = Price.objects.all().order_by('id')
      return render(request, 'prices.html', {'prices':prices})
  </code></pre>
  
  <h1>prices.html</h1>
  
  <pre><code>&lt;div class="col-md-8"&gt;
       &lt;table class="table table-striped"&gt;
           &lt;thead&gt;
               &lt;tr&gt;
                   &lt;th&gt;TYPE&lt;/th&gt;
                   &lt;th&gt;NAME&lt;/th&gt;
                   &lt;th&gt;PRODUCT&lt;/th&gt;
                   &lt;th&gt;VALUE&lt;/th&gt;                 
               &lt;/tr&gt;
           &lt;/thead&gt;
           &lt;tbody&gt;
           {% for price in prices %}
               &lt;tr&gt;
                   &lt;td&gt;{{ price.type }}&lt;/td&gt;
                   &lt;td&gt;{{ price.name }}&lt;/td&gt;
                   &lt;td&gt;{{ price.product }}&lt;/td&gt;
                   &lt;td&gt;{{ price.value }}&lt;/td&gt;
               &lt;/tr&gt;
           {% endfor %}
           &lt;/tbody&gt;
       &lt;/table&gt;
   &lt;/div&gt;
  </code></pre>
  
  <h1>urls.py</h1>
  
  <pre><code>urlpatterns = [
       url(r'^prices/', product_views.prices, name='prices'),
       url(r'^admin/', admin.site.urls),
  ]
  </code></pre>