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

1 $.ajax({
2 url: actionurl,
3 type: "POST",
4 datType: "JSON",
5 data: { id: nodeId },
6 async: false,
7 success: function () {}
8 });

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

1 $.ajax({
2 url: actionurl,
3 type: "POST",
4 datType: "JSON",
5 contentType: "application/json"
6 data: "{'id': " + nodeId +"}",
7 async: false,
8 success: function () {}
9 });

 

 

相关文章:

  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-05
  • 2022-12-23
  • 2021-10-07
  • 2021-12-18
猜你喜欢
  • 2022-12-23
  • 2021-09-06
  • 2022-12-23
  • 2021-10-28
  • 2022-02-12
  • 2022-01-10
相关资源
相似解决方案