I am trying to send a json object using GET method. My code:
$.ajax({
url: \"/api/endpoint\",
type: \"GET\",
data: {\"sort\"
There are a few places where you have gone a bit wrong.
CONTENT_LENGTH
, its Content-Length
.Content-Length
header, the browser will do it for you.Something like the below should work for you:
$.ajax({
url: "/api/endpoint?parameters="+encodeURIComponent(JSON.stringify({"sort":"date"})),
type: "GET",
...
});