title: Ajax request not returning an HttpResponse
body: <p>I'm coding a django web app with only one page. This page contains a form with some inputs. When I click on the submit button, I make an ajax call to a function in python. I want to get back some data from this function.</p>
  
  <p><strong>HTML file:</strong></p>
  
  <pre><code>&lt;form id="strategy" method="post" class="edit_user"&gt;
    {% csrf_token %}
    &lt;div class="sel-schedule"&gt;
      &lt;label&gt;Label: &lt;/label&gt;
      &lt;input id="start_time" type="time" name="start_time" value="09:30" required&gt;
    &lt;/div&gt;
    &lt;button type="submit" class="inactive boton-lanzar"&gt;Launch&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>JS file</strong>:</p>
  
  <pre><code>$('#strategy').on('submit', function(event){
      var start_time = document.getElementsByName("start_time")[0].value;
      var url = '/method_calculation/';
      $.ajax(url, {
          data: {
              'start_time': start_time,
          },
          dataType: 'json',
          success: function (data) {
            console.log("new")
          }
      })
  });
  </code></pre>
  
  <p><strong>Urls file:</strong></p>
  
  <pre><code>urlpatterns = [
  path('admin/', admin.site.urls),
  path('', home, name='home'),
  path('method_calculation/', method_calculation, name="method_calculation"),
  ]
  </code></pre>
  
  <p><strong>Views file:</strong></p>
  
  <pre><code>def home(request):
      if request.method == "GET":
          return render(request, 'index.html')
      else:
          return HttpResponse("OK")
  
  
  def method_calculation(request):
      if request.method == 'POST':
  
          start_time_hour = int(request.POST.get('start_time')[0:2])
          start_time_minute = int(request.POST.get('start_time')[3:5])
          data_comparison = caculate_summit(start_time_hour, start_time_minute)
  
          args = {data_comparison}
          return JsonResponse(args)
  </code></pre>
  
  <p>I'm a bit confused. </p>
  
  <p>First, I don't want the page to reload but if I take out the return HttpResponse it says that it needs it.</p>
  
  <p>Second, with the current files I get the following error:</p>
  
  <pre><code>The view myapp.views.method_calculation didn't return an HttpResponse object. It returned None instead.
  </code></pre>
  
  <p>What am I missing?</p>
  
  <p>Many thanks</p>