title: Reload the page without refreshing with django and ajax
body: <p>i'm developing a site that uses Django to check cryptocurrency prices.
  I want to load a value stored in django sqlite3 database file without refreshing (F5) using ajax. What should I do?</p>
  
  <p>(However, if the user manually refreshes the page, the value will change. This is because the value is loaded from the database.)</p>
  
  <p>Cryptocurrency prices and other information are automatically collected by the crawler and stored in real time in db.sqlite3 in your Django project.</p>
  
  <p><strong>index.html</strong> (this HTML template is static, its value does not change in real time.)</p>
  
  <pre><code>{% extends 'exchange/layout.html' %}
  {% load humanize %}
  {% block title %}XCoin{% endblock %}
  {% block body %}
  &lt;table class="table table-condensed"&gt;
   &lt;thead&gt;
     &lt;tr&gt;
        &lt;th&gt;#&lt;/th&gt;
        &lt;th&gt;Name&lt;/th&gt;
        &lt;th&gt;Price&lt;/th&gt;
        &lt;th&gt;Market Cap&lt;/th&gt;
        &lt;th&gt;Volume (24h)&lt;/th&gt;
        &lt;th&gt;Circulating Supply&lt;/th&gt;
     &lt;/tr&gt;
   &lt;/thead&gt;
   &lt;tbody&gt;
     {% for coin in coins %}
     &lt;tr&gt;
        &lt;td&gt;{{coin.ranking}}&lt;/td&gt;
        &lt;td&gt;[ {{coin.abbreviation}} ]  {{coin.name}}&lt;/td&gt;
        &lt;td&gt;{{coin.price|intcomma}}$&lt;/td&gt;
        &lt;td&gt;{{coin.marketcap|intcomma}}$&lt;/td&gt;
        &lt;td&gt;{{coin.volume|intcomma}}$&lt;/td&gt;
        &lt;td&gt;{{coin.circulatingsupply|intcomma}} {{coin.abbreviation}}&lt;/td&gt;
     &lt;/tr&gt;
     {% endfor %}
   &lt;/tbody&gt; 
  
  &lt;/table&gt;
  {% endblock %}
  </code></pre>
  
  <p><strong>urls.py</strong></p>
  
  <pre><code>from django.contrib import admin
  from django.urls import path
  from . import views
  
  app_name = 'exchange'
  urlpatterns = [
      path('admin/', admin.site.urls),
      path('', views.index, name='home'),
  ]
  </code></pre>
  
  <p><strong>models.py</strong></p>
  
  <pre><code>from django.db import models
  
  class Coin(models.Model):
      ranking = models.IntegerField() # coin ranking
      abbreviation = models.CharField(max_length=10) # coin symbol
      name = models.CharField(max_length=20) # coin name
      price = models.FloatField() # coin price ($)
      marketcap = models.IntegerField() # coin marketcap ($)
      volume = models.IntegerField() # coin volume (24h)
      circulatingsupply = models.IntegerField() # coin supply
  
      def __str__(self):
          return self.name
  </code></pre>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>from .models import Coin
  from django.shortcuts import render
  from django.shortcuts import HttpResponse
  
  def index(request):
      coin = Coin.objects.all()
      context = {'coins':coin}
      return render(request, 'exchange/index.html', context)
  </code></pre>