title: form submit going to new page instead of loading in view of django ajax form
body: <p>I have a simple form that I am testing an ajax call from.  The ajax.html file looks like this:</p>
  
  <pre><code>&lt;form id="ajaxform" method="get" action="/polls/ajax/submit/"&gt;
      &lt;p&gt;
          &lt;input type="text" name="input" id="input" /&gt;
          &lt;input type="submit" value="Submit" /&gt;
      &lt;/p&gt;
  &lt;/form&gt;
  
  &lt;script type="text/javascript"&gt;
      $(document).ready(function () {
          $('#ajaxform').ajaxForm({
              success: ajaxformSubmit,
              dataType: 'json',
              clearForm: true,
              resetForm: true
          });
      });
  
      function ajaxformSubmit(responseText, statusText, xhr, $form) {
          if (responseText['success'] == true) {
              alert("Added item: " + responseText['pk']);
          }
  
          // returning false inhibits the browser from opening a "Save As" dialog.
          return false;
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>It's views.py looks like this:</p>
  
  <pre><code>def ajax_test(request):
      form = AjaxForm()
  
      context = {
          'form': form
      }
      return render(request, 'polls/ajax.html', context)
  </code></pre>
  
  <p>This form submits to this ajax function:</p>
  
  <pre><code>def AjaxSubmit( request ):
      GET = request.GET
      results = { 'success' : False }
      form = AjaxForm( request.GET )
  
      if form.is_valid():
          print form.cleaned_data['input']
          results['success'] = True
  
      return HttpResponse( simplejson.dumps( results ), mimetype='application/json' )
  </code></pre>
  
  <p>The urls.py looks like:</p>
  
  <pre><code>urlpatterns = patterns('',
      url(r'^ajaxform/$', views.ajax_test, name='ajax-test'),
  )
  
  urlpatterns += patterns( 'polls.ajax',
      (r'^ajax/submit/$', 'AjaxSubmit' ),
  
  )
  </code></pre>
  
  <p>The problem is that when i go to the page at <code>http://localhost:8000/polls/ajaxform/</code> and I submit, the page goes to the json that is returned to url: <code>http://localhost:8000/polls/ajax/submit/?input=test</code>  It should stay on the same form page and invoke the json response with the javascript.</p>
  
  <p>I did <a href="http://www.jonhill.ca/programming/ajax-forms-in-django" rel="nofollow">this tutorial</a> .</p>
  
  <p>Is there something I am doing wrong?</p>