title: ajax request django , jquery
body: <pre><code>#home.html
  &lt;html&gt;
  &lt;head&gt;
  &lt;script type="text/javascript"&gt;
  $(window).load(function() {
  alert("Example of a basic alert box in jquery");
  $.ajax({
      type: 'POST' ,
      url: '{% url "filter.views.myajax" %}',
      datatype: 'json' ,
      async: true,
      data:{
          csrfmiddlewaretoken: '{{ csrf_token }}',
          sentence: $('#word').val()
      },
  
      success: function(json) {
          $('#output').html(json.message);
      }
    });
  
    }
  
  
  
  });
  
  &lt;/script&gt;
  &lt;title&gt; My first &lt;/title&gt;
  &lt;body&gt;
  &lt;div id="output"&gt; &amp;nbsp; &lt;/div&gt;
  &lt;div&gt;
  &lt;form onsubmit="return false;"&gt;
  {% csrf_token %}
  Enter :- &lt;br /&gt;
  &lt;input type="text" id="word" /&gt; &lt;br /&gt;
  &lt;button onclick="callajax()"&gt; Submit &lt;/button&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  
  #views.py
  def myajax(request):
  sentence= request.POST.get("sentence","")
  response_data={}
  
  try:
      response_data['title']='Hey its done ajax'
      response_data['message']=fil(sentence)
  
  except:
      response_data['title']='NO'
      response_data['message']='NO'
  
  return HttpResponse(json.dumps(response_data),content_type="application/json")
  #url.py
  from django.conf.urls import patterns, include, url
  
  from django.contrib import admin
  admin.autodiscover()
  
  urlpatterns = patterns('',
  # Examples:
  url(r'^hello/$', 'filter.views.hello'),
  url(r'^ajax/$', 'filter.views.myajax'),
  )
  </code></pre>
  
  <p>I have been trying to implement ajax through jquery and update a div according to the response. There is no output shown when i click submit button. I have added the view.py and my template file here.
  What is the issue here ? </p>