在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. Verilog hdl 实现单周期cpu

    参考计组实验测试指令 - 简书,添加了一些细节. 1.添加 bne指令 修改 ctrl.v       之后修改mipstestloopjal_sim.asm,mars dump 为 bnetest. ...

  2. ServerLess & MongoDB Atlas & REST API

    ServerLess & MongoDB Atlas & REST API ServerLess, Nodejs, MongoDB Atlas cloud 构建 REST API ht ...

  3. Flutter App 真机调试

    Flutter App 真机调试 Deploy to iOS devices https://flutter.dev/docs/get-started/install/macos#deploy-to- ...

  4. es6 & map & set

    es6 & map & set Map & WeakMap https://developer.mozilla.org/en-US/docs/Web/JavaScript/Re ...

  5. modal 弹框遮罩层,滚动穿透bug 解决方案

    modal 弹框遮罩层,滚动穿透bug 解决方案 parent component 动态设置 lock css const computedClassName = classNames( 'activ ...

  6. c++指针练习

    Pointers 在getchar处断点,断点后,调试->窗口->反汇编 查看数据 main #include <iostream> #include <Windows. ...

  7. 聚焦 2021 NGK 新加坡区块链技术峰会,探讨DeFi未来新生态!

    2021年1月31日14时,备受行业关注的"2021 NGK 新加坡区块链技术峰会"如期举行.本次峰会由NGK官方主办,以"DeFi"为主题,探讨了区块链技术革 ...

  8. NGK Global首尔站:内存是未来获取数字财富的新模式

    近日,NGK路演在NGK韩国社区的积极举办下顺利落下帷幕.此次路演在首尔举行,在活动当天,NGK的核心团队成员.行业专家.投资银行精英.生态产业代表和数百名NGK韩国社区粉丝一起参加NGK Globa ...

  9. 翻译:《实用的Python编程》02_01_Datatypes

    目录 | 上一节 (1.7 函数) | 下一节 (2.2 容器) 2.1 数据类型和数据结构 本节以元组和字典为代表介绍数据结构. 原始数据类型 Python 有一些原始数据类型: 整数 浮点数 字符 ...

  10. Python学习笔记_有关tuple的几点强调

    创建只有一个元素的tuple,需要用逗号结尾消除歧义 a_tuple = (2,) tuple中的list mixed_tuple = (1, 2, ['a', 'b']) print("m ...