title: Django: Call Python Function on Button Click and Display String
body: <p>I found a couple of resources online, but none that worked for me. Here is what I currently have:</p>
  
  <p>In views.py:</p>
  
  <pre><code>def button(request):
      return render(request, 'home.html')
  
  def display_text(request):
      return HttpResponse('TESTING', status=200)
  </code></pre>
  
  <p>In urls.py:</p>
  
  <pre><code>urlpatterns = [
      url(r'^$', views.button),
      url(r'^display_text', views.display_text, name='script'),
  ]
  </code></pre>
  
  <p>In home.html:</p>
  
  <pre><code>      &lt;div class="row"&gt;
          &lt;input type="text" class="form-control js-text" id="input-box" placeholder="Type something to begin..."/&gt;
          &lt;div class="col-md-12" style="text-align:center;"&gt;
              &lt;button onclick="location.href='{% url 'script' %}'"&gt;&lt;/button&gt; &lt;hr&gt;
          &lt;/div&gt;
        &lt;/div&gt;
  </code></pre>
  
  <p>What happens right now is that it displays the string on a new web page. What I want to do is populate my text-box with that string returned by my Python function, and display it on the current page. How can I do so? Thanks!</p>