jQuery Ajax GET和contentType? [英] jQuery Ajax GET and contentType?

查看:372
本文介绍了jQuery Ajax GET和contentType?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于:(jQuery ajax方法):

Regarding : (jQuery ajax method) :

当请求本身是GET请求时,是否计算contentType属性? (示例)

Does contentType property is counted when the request itself is a GET request ? (example)

$.ajax({
    type: "GET",
    url: "/webservices/xxx.asmx/yyy",
    data: JSON.stringify({ Markers: markers }),
    contentType: "application/json; charset=utf-8",
    dataType: "json",.......

});

p.s.

contentType是我发送到服务器的数据形式
dataType是我期望从服务器获取的数据形式.

contentType is the form of data which i send to the server
dataType is the form of data which i EXPECT to get from server.

推荐答案

根据 RFC 2616 ,不禁止在GET请求中使用请求正文.
但是,我想知道确实在主体中发送数据的客户端实现和在GET请求主体中解析数据的服务器实现.

According to the RFC 2616, it's not forbidden to use the request body in GET requests.
However, I'd like to know of an client implementation which does send data in the body and an server implementation which parses data in the body of GET requests.

所以基本上,不,不使用Content-Type标头.

So basically, no, the Content-Type header is not used.

这篇关于jQuery Ajax GET和contentType?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆