[转] $.ajax中contentType: “application/json” 的用法

不使用contentType: “application/json”则data可以是对象

$.ajax({
url: actionurl,
type: "POST",
datType: "JSON",
data: { id: nodeId },
async: false,
success: function () {}
});

使用contentType: “application/json”则data只能是json字符串

$.ajax({
url: actionurl,
type: "POST",
datType: "JSON",
contentType: "application/json"
data: "{'id': " + nodeId +"}",
async: false,
success: function () {}
});
上一篇:9.1 Kubernetes_集群部署


下一篇:XML Parser Error on line 1: 前言中不允许有内容, Mybatis 生成代码