Regarding : (jQuery ajax method) :
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 is the form of data which i send to the server
dataType is the form of data which i EXPECT to get from server.
contentType is the type of data you're sending, so application/json; charset=utf-8 is a common one, as is application/x-www-form-urlencoded; charset=UTF-8 , which is the default. dataType is what you're expecting back from the server: json , html , text , etc.
You can't as it's asynchronous. If you want to do anything with it, you need to do it in a callback. How? Because it's asynchronous, javascript will fire off the ajax request, then immediately move on to execute the next bit of code, and will probably do so before the ajax response has been received.
contentType option to false is used for multipart/form-data forms that pass files. When one sets the contentType option to false , it forces jQuery not to add a Content-Type header, otherwise, the boundary string will be missing from it.
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.
So basically, no, the Content-Type
header is not used.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With