title: Return JSON response without redirecting
body: <p>I'm new with django and i'm trying to update fields in my view without redirecting, i'm trying to return a JSON file when a view function is called, but i can't seem to find how to do so withouth redirecting to some url.</p>
  
  <p>I think it may have something to do with my urls.py: ... path('#', views.myFunction, name='myFunctionName').</p>
  
  <p>I'm messing arround with the django tutorial that appears in djangoproject.com</p>
  
  <pre><code>&lt;h1&gt;{{ question.question_text }}&lt;/h1&gt;
  &lt;ul&gt;
  {% for choice in question.choice_set.all %}
  &lt;li&gt;{{ choice.choice_text }} -- {{ choice.votes }} vote{{ choice.votes|pluralize }}&lt;/li
  {% endfor %}
  &lt;/ul&gt;
  &lt;a href="{% url 'polls:detail' question.id %}"&gt;Vote again?&lt;/a&gt;
  &lt;a href="{% url 'polls:myfunction' %}"&gt;doFunction&lt;/a&gt;
  </code></pre>
  
  <p>my view function goes like this:</p>
  
  <pre><code>def myfunction(request):
      return JsonResponse({'ayy':'lmao'})
  </code></pre>
  
  <p>and the urls.py:</p>
  
  <pre><code>from django.urls import path
  
  
  from . import views
  
  app_name = 'polls'
  urlpatterns = [
  path('', views.IndexView.as_view(), name='index'),
  path('&lt;int:pk&gt;/', views.DetailView.as_view(), name='detail'),
  path('&lt;int:pk&gt;/results/', views.ResultsView.as_view(), name='results'),
  path('&lt;int:question_id&gt;/vote/', views.vote, name='vote'),
  path(r'#', views.myfunction, name='myfunction'),
  path('form', views.FormView.as_view(), name='form'),
  </code></pre>