<分区>
我使用以下脚本通过 ajax 发送 JSON:
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);
}
});
但是我的服务器收到一个查询字符串,例如 test=opa&foo=bar
。我做错了什么?