title: ajax with django forms
body: <p>can i add the ajax code with django?
  i have created a simple registraion form that have 5 fields . i wish to disply the each fields in different pages but in a single window . it means  by using next button 5 pages want to disply in a single window. same time all content of each page i want add to my database. is this possible in django with ajax..</p>
  
  <p>my codes are as follows  :</p>
  
  <pre><code>      #view 
  
          from django.shortcuts import render_to_response
          from registration.models import UserDetails
          from forms import UserForm
          from django import forms
          from django.template import RequestContext
          from django.http import HttpResponseRedirect
  
          def user_details(request):
              if request.method == 'POST':
                  form = UserForm(request.POST)
                  if form.is_valid():
                      form.save()
  
  
              else:
                  form = UserForm()        
              return render_to_response("career.html", {"form": form},context_instance=RequestContext(request))
  
  
  
  #form 
  
       from django import forms
       from registration.models import UserDetails
  
       class UserForm(forms.ModelForm):
          pass
  
          class Meta:
              model = UserDetails
  
  
  
  #model 
  
          from django.db import models
  
          class UserDetails(models.Model):
              fname=models.CharField(max_length=20)
              lname=models.CharField(max_length=20)
              email = models.EmailField()
              address = models.CharField(max_length=50)
              country = models.CharField(max_length=20)
              def __unicode__(self):
                  return self.fname
                  return self.lname
                  return self.email
                  return self.address
                  return self.country
  
  
  
   #url
  
          from django.conf.urls.defaults import patterns, include, url
  
          from django.contrib import admin
          admin.autodiscover()
  
          urlpatterns = patterns('',
              # Examples:
               url(r'^registration/$', 'registration.views.user_details', name='user_details'),
  
              url(r'^admin/', include(admin.site.urls)),
          )
  
  
  
   # template 
  
          &lt;form enctype="multipart/form-data" method="post"&gt;{% csrf_token %}
              {{ form.as_p }}
             &lt;input type="submit" ....&gt;
          &lt;/form&gt;
  </code></pre>