What should the value of content-type http header be if the message body is JSONP. application/javascript?
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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.