title: Django: update a page without reloading
body: <p>I want to update my <strong>homepage.html</strong> with button action and show some result from the server. But the problem is when I click on the button the whole page is reloading. Here, my project name is "T2KG". My form tag looks like this:</p>
  
  <pre><code>&lt;form method="POST"&gt;
          {% csrf_token %}
  
          &lt;center&gt;&lt;textarea placeholder="Give a input sentence....."
        class="text" name="sent" rows="5" cols="70" font="15px arial, sans-serif" autofocus&gt;Barack Obama born in Hawaii. Hawaii locates in USA.&lt;/textarea&gt;&lt;/center&gt;&lt;br&gt;
          &lt;button type="submit" class="btn btn-primary btn-block" id="display_result"&gt;Generate Triple&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>By searching in many websites I have understood that my view.py and urls.py is not correct and also I have to use AJAX. But How to implement in this situation I don't know. I have tried but couldn't find any way out. In view.py I return the value like this:</p>
  
  <pre><code>def result(request):
  text = 'null'
  if request.method == 'POST':
      form_input = Sentence(request.POST)
      if form_input.is_valid():
          text = form_input.cleaned_data['sent']
      else:
          form_input = Sentence()
  
  triples = getTriples(text)
  
  ent_list = entityList(text)
  triples = predicateList(aggregate(triples, ent_list))
  return render(request, './T2KG/homepage.html',{'triples': triples, 'json_triples': json.dumps(triples), 'text':text})
  </code></pre>
  
  <p>And my urls.py is:</p>
  
  <pre><code>urlpatterns = [
  path('', views.set_sent, name='set_text'),
  url(r'^T2KG/homepage', views.result, name='result'),]+static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
  </code></pre>
  
  <p>Please help me. </p>