I am sending JSON via ajax with the following script:
var dat = {"test":"opa"};
console.log(dat);
$.ajax({
contentType: "application/json",
method: "POST",
url: "/test",
dataType: "json",
data: dat,
success:function(res){
console.log(res);
}
});
But my server receives a query string such as test=opa&foo=bar
. What am I doing wrong?