- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将一些 json POST 到接受 json 的 Web 服务。
函数“basistech.serializeOptions()”此时返回一个 Javascript 对象,但是我可以轻松地返回一个字符串。请注意,即使我设置了“接受”选项,发送的 header 是“Accept: undefined”,这会导致服务器端出现一些故障。
为什么我不能在“accepts”中给出正确的 mime 类型?
$.ajax({
url : basistech.processText_url,
accepts : "application/json",
contentType : "application/json",
dataType : "json",
data : basistech.serializeOptions(),
type : "POST",
success : function(data) {
/* whatever */
},
error : function(jqXHR, textStatus, errorThrown) {
$("#submit-button").busy("hide");
alert(textStatus);
}
});
POST /r4dws/services/doc/processText HTTP/1.1
Host: localhost:15000
Connection: keep-alive
Content-Length: 1679
Origin: http://localhost:15000
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2
Content-Type: application/json
Accept: undefined
Referer: http://localhost:15000/r4dws/demo/xmltextbox.jsp
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: JSESSIONID=AB76A77DF6906229D281A931D7D10C3C
Request Payload
(messed up)
最佳答案
尝试这样......,
$.ajax({
url : basistech.processText_url,
headers: {
Accept : "application/json",
"Content-Type": "application/json"
},
dataType : "json",
data : basistech.serializeOptions(),
type : "POST",
success : function(data) {
/* whatever */
},
error : function(jqXHR, textStatus, errorThrown) {
$("#submit-button").busy("hide");
alert(textStatus);
}
});
关于jquery - 使用 JQuery 发送 json 内容,MIME 类型和序列化出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8198277/
如果上传的文件没有扩展名,是否必须指定 MIME 类型?换句话说,是否有默认的通用 MIME 类型? 最佳答案 对于未知类型,您可以使用application/octet-stream。 RFC 20
MIME 类型的官方 URN 是否存在? Mozilla Firefox 和其他应用程序使用诸如“urn:mimetype:text/plain”或“urn:mimetype:handler:text
我们有一个由 xyz 网站管理员部署在生产环境中的网站。以下是在两个不同实例中发生错误时 Web 控制台的两个屏幕截图。 我们时断时续地而不是始终如一地面对这个问题。此外,这种情况发生在少数用户而不是
此错误仅在 chrome 中显示。我正在搜索这个问题,但还没有找到 令人满意的解决方案。我附上了该错误的屏幕截图。请为此提出一些想法。 Error image 最佳答案 样式表的 MIME 类型应该是
当我使用 MAMP 托管我的 Drupal 站点时,出现了上述错误。我所有的 HTML 加载,但我的 CSS 没有加载。 拒绝应用来自“http://mysite/sites/default/file
错误信息: jquery.dataTables.min.js:23 未捕获类型错误:无法读取未定义的属性“长度” 在 Ha (jquery.dataTables.min.js:23) 在 HTMLTa
Raw images由相机、扫描仪等生成,通常比 JPEG 图像具有更大的后处理灵活性。 如果我从我的 Web 服务器提供这种文件,我应该使用哪种媒体类型(又名 MIME 类型)? 我对最近的佳能相机
我已经查看了大约 100 个站点,但没有找到任何内容。有些只是 mime 类型值的列表,有些只是对 RFC 的引用,或者或多或少是直接引用它们。 RFC 是难以理解的,每一个都只揭示了大象的一小部分。
我想用 image/*数据 URI 中的 MIME 类型,例如data:image/*;base64,R0lGODlhE...在 元素。 它是否完全符合标准的 MIME 类型? 它会在某些浏览器中引起
我有一个 PHP 脚本,用于下载不同类型的文件(PDF、JPEG、RAR 等)。效果很好,但是我注意到 MIME 类型存在问题。 是否有我可以安全地用于“通用目的”的通用 MIME 类型?我正在考虑所
我的程序使用自己的二进制文件类型,因此我假设我不能使用 MIME 类型文本/纯文本,因为它不是 7 位 ASCII 文件。 我应该将其命名为“application/myappname”吗? 最佳答案
我正在调试一个 MIME 解析器,它无法解析来自一个电子邮件服务的 header 。电子邮件服务包含一个 header ,该 header 由完全位于下一行的字段主体组成,如下所示: Message-
我有一个 Vue.js 项目,当我检查控制台时发现以下问题: Refused to apply style from 'http://localhost:8080/dist/cropper.min.c
friend 们,我花了一整天的时间寻找这个问题的解决方案,但我一直无法修复它。当我为生产构建它时,在开发模式下(没有缩小和其他东西)它在本地主机上运行良好,但是当我在 dist 文件夹中获取我的文件
Swagger 默认支持 application/json 作为 Content 类型。如果我想添加其他内容类型,则需要在 swagger JSON 文件中更新“生产”或“消费”字段。客户可以发送任何
我的网络服务生成并返回一个 .tex 文件。我想在 http-header 中提供正确的 mimetype。 除了here我没找到这么多,我在其中找到 application/x-tex。这是要坚持的
我需要区分不同类型的 HTML 模板,例如来自 Handlebars 模板的 FreeMarker。由于模板在数据库中(所以它们不是文件,即没有文件名或扩展名)我想使用 MIME 类型来识别它们。 对
我想知道 iWork 页面的 mime 类型是什么?以及 iWork 套件中其余软件的 mime 类型是什么?我在网上环顾四周,没有看到任何地方。 最佳答案 我最近需要这个来工作,结果只是上传了一些文
我正在构建一个 mime 类型的猜测器,我正在使用 mimetype命令来检查我的结果。对于日志文件,它返回 text/x-log .我在这些列表中没有看到这种 mime 类型: http://svn
有谁知道 Markdown 是否存在 MIME 类型?我猜是 text/plain,但是有更具体的吗? 最佳答案 tl;dr:text/markdown 自 2016 年 3 月起 2016 年 3
我是一名优秀的程序员,十分优秀!