title: Jquery in Django
body: <p>I am trying to learn using Jquery in django application.My code looks like this</p>
  
  <p><strong>views.py</strong> </p>
  
  <pre><code>from django.shortcuts import render
  from django.http import HttpResponse
  from airapp.models import Travel
  
  def search_form(request):
      return render(request, 'search_form.html')
  
  
  def search(request):
      if 'f' in request.GET and request.GET['f']:
          q = request.GET['f']
          books = Travel.objects.filter(froms__icontains=q)
          return render(request, 'search_results.html',
              {'books': books, 'query': q})
      else:
          return HttpResponse('Please submit a search term.')   
  </code></pre>
  
  <p><strong>urls.py</strong></p>
  
  <pre><code>from django.conf.urls import patterns, include, url
  from air import views
  
  # Uncomment the next two lines to enable the admin:
  from django.contrib import admin
  admin.autodiscover()
  
  urlpatterns = patterns('',
  
      url(r'^admin/', include(admin.site.urls)),
      url(r'^search-form/$', views.search_form),
      url(r'^search/$', views.search),
  )
  </code></pre>
  
  <p><strong>search_form.html</strong></p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Search&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form action="/search/" method="get"&gt;
          FROM&lt;input type="text" name="f"&gt;&lt;br&gt;
          TO&lt;input type="text" name="t"&gt;&lt;br&gt;
          CLASS&lt;input type="text" name="c"&gt;&lt;br&gt;
          &lt;input type="submit" value="Search"&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;     
  </code></pre>
  
  <p><strong>search_results.html</strong></p>
  
  <pre><code>&lt;p&gt;You searched for: &lt;strong&gt;{{ query }}&lt;/strong&gt;&lt;/p&gt;
  
  {% if books %}
      &lt;p&gt;Found {{ books|length }} book{{ books|pluralize }}.&lt;/p&gt;
      &lt;ul&gt;
          {% for book in books %}
          &lt;li&gt;{{ book.froms }}&lt;/li&gt;
          &lt;li&gt;{{ book.to}}&lt;/li&gt;
          &lt;li&gt;{{ book.classs }}&lt;/li&gt;
          &lt;li&gt;{{ book.details }}&lt;/li&gt;
  
          {% endfor %}
      &lt;/ul&gt;
  {% else %}
      &lt;p&gt;No books matched your search criteria.&lt;/p&gt;
  {% endif %}
  </code></pre>
  
  <p>When the search result displays it will be on a new html page(search_results.html).I want to display search results on the same html page where form is created(search_form.html) when I click search button.Can I display it using jquery? Can anybody help me write the code.
  Also anybody suggest me good tutorial for learning ajax and jquery &amp; how can I use it django 
  application development.</p>