Reputation: 10458
What should the value of content-type http header be if the message body is JSONP. application/javascript?
Upvotes: 7
Views: 13340
Reputation: 100051
If you want ajax to work for the case in which you have a file upload field in a form as part of the input, and you aren't using XHR2, it must be 'text' or 'text/html' and you need to surround it with a fake HTML element. See the jquery forms ajax support doc for all the nasty details.
Upvotes: 0
Reputation: 1108782
Depends on the body's actual content. That's what the Content-Type
header stands for.
So, if you write a JS callback function to the body, then yes, it should be application/javascript
.
Or, if you write a JSON string to the body, then no, it should be application/json
instead.
Upvotes: 15