title: Django jQuery post request
body: <pre><code>$.ajax({
      url:'/',
      type: "POST",
      data: {name: 'name', age: 'age'},
      success:function(response){},
      complete:function(){},
      error:function (xhr, textStatus, thrownError){}
  });
  </code></pre>
  
  <p>And in views.py:</p>
  
  <pre><code>class SomeView(generic_views.TemplateView):
      template_name = 'something.html'
  
      def get(self, request, *args, **kwargs):
          ...something...
          return self.render_to_response(context)
  
      def post(self, request, *args, **kwargs):
          name = request.POST['name']
          age = request.POST['age']
          ...something...
  </code></pre>
  
  <p>And I get: <b>[05/Oct/2012 12:03:58] "POST /something/ HTTP/1.1" 403 2294</b></p>
  
  <p>I'd like to send this data(name and age) via jQuery to this post function in "SomeView". This is the same view as the loaded template, just the request type is different. On get() the template loads and on post, the post() function should be called. Is it possible? I've checked other questions and got this solution. It was supposed to be working. What am I doing wrong?</p>