在ajax方法设置中若不添加 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 () {}
});
不添加 contentType: "application/json" 情况下传递多个数据:
{
"id":id[1],
"name":"小明"
}

此时将id和name传到后台。

随机推荐

  1. 网站备案查询/ICP备案查询网

    网站备案查询/ICP备案查询网 互联网站备案信息全国公安机关互联网站安全服务平台http://www.beian.gov.cn/portal/index 1 http://www.miitbeian. ...

  2. js screen size check

    js screen size check js 屏幕尺寸检测 window.screen API screen; window.screen.width; window.screen.height; ...

  3. Programming Interview Questions Websites All In One

    Programming Interview Questions Websites All In One 编程面试刷题网站 http://highscalability.com/ https://tri ...

  4. LeetCode Binary Search All In One

    LeetCode Binary Search All In One Binary Search 二分查找算法 https://leetcode-cn.com/problems/binary-searc ...

  5. js 小数转整数,避免精度损失 bug

    js 小数转整数,避免精度损失 bug const arr = [ 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01, 0.01 ]; // ( ...

  6. awesome youtube programming video tutorials

    awesome youtube programming video tutorials youtube programming tutorials https://www.youtube.com/fe ...

  7. HTML marquee

    HTML marquee 跑马灯 https://developer.mozilla.org/en-US/docs/Web/HTML/Element/marquee https://developer ...

  8. VAST重磅出击,NGK网络搜索量超越ETH!

    Wechat指数中,NGK超越ETH,NGK搜索指数是157648点位,单日环比上涨11.95%,ETH搜索指数是115604点位,就连区块链标杆的BTC也仅仅只有171669点位,我们可清楚的看到N ...

  9. PBN进场程序保护区图例分析

      疫情仍在持续,除了待家里不给祖国添乱之外,过去没有时间去完成的事情,现在可以静下心来认真面对,充实过好每一天. 今天想跟大家聊一下ICAO 8168第二卷PBN进场程序的图例. 就是下面这张图: ...

  10. [转]自动驾驶平台Apollo 2.5环境搭建

    原文地址:https://blog.csdn.net/jinzhuojun/article/details/80210180,转载主要方便随时查阅,如有版权要求,请及时联系. 我们知道,自动驾驶在学界 ...