application/json
application/x-javascript
text/javascript
text/x-javascript
text/x-json
我用哪一种,在哪里?我假设安全和浏览器支持问题是一个因素。
application/json
application/x-javascript
text/javascript
text/x-javascript
text/x-json
我用哪一种,在哪里?我假设安全和浏览器支持问题是一个因素。
当前回答
“application/json
”是正确的JSON内容类型。
def ajaxFindSystems = {
def result = Systems.list()
render(contentType:'application/json') {
results {
result.each{sys->
system(id:sys.id, name:sys.name)
}
}
resultset (rows:result.size())
}
}
其他回答
Content-Type: application/json
-杰森Content-Type: application/javascript
- 杰森-普Content-Type: application/x-javascript
- JavaScriptContent-Type: text/javascript
- JavaScript 但是,但用于 HTML 属性的旧的因特网探索者版本。Content-Type: text/x-javascript
- JavaScript媒体类型,但是,但过时Content-Type: text/x-json
- 曾经杰森申请/日文正式注册。JSON 的正确内容类型是application/json
除非你们在使用贾索普,也称为 Json with Padding, 实际上是 JavaScript, 所以正确的内容类型将是application/javascript
.
PHP 开发商使用此功能 :
<?php
header("Content-type: application/json");
// Do something here...
?>
我用下面的用法
contentType: 'application/json',
data: JSON.stringify(SendData),
“application/json
”是正确的JSON内容类型。
def ajaxFindSystems = {
def result = Systems.list()
render(contentType:'application/json') {
results {
result.each{sys->
system(id:sys.id, name:sys.name)
}
}
resultset (rows:result.size())
}
}