#17474: Problem when the request doesn't have Content-Type.
-------------------------------------+-------------------------------------
     Reporter:  Marcelo Salhab       |                    Owner:  nobody
  Brogliato <msbrogli@…>             |                   Status:  reopened
         Type:  Bug                  |                  Version:  1.3
    Component:  HTTP handling        |               Resolution:
     Severity:  Normal               |             Triage Stage:  Design
     Keywords:  content-type         |  decision needed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by jroweboy@…):

 Just had a similar problem myself, and I suspect it might have the same
 root problem. I hate to suggest a workaround for things, but for anyone
 else who has a similar problem, you might be able to directly specify the
 CONTENT-TYPE in your ajax request. I don't know why it wasn't sending it
 by default as 'application/x-www-form-urlencoded' as the documentation
 says it does (http://api.jquery.com/jQuery.ajax/) so I ended up explicitly
 adding it in the ajax function call. Example:

 {{{
 $.ajax({
      type: 'POST',
      url: 'your url',
      success: function(data){
          // function to call on success
      },
      dataType: 'text',
      contentType: 'application/x-www-form-urlencoded',
 });

 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17474#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to