1.语法

$.ajax{

  type:'get',//类型 有get post

  url:'',//路径

  data:{name:$('#ma').val(),nameq:$('#maq').val()},

  dataType="json",

  success:function(data){alert("成功了")}

}

2.获取data数据的方法

如果这样写的话会写吐血的name:$('#ma').val(),nameq:$('#maq').val()

可以用map方法

var map=$(':checkbox').map(function() {
  return ($(this).attr("id")+'='+$(this).val());
}).get().join('&');
alert(map)

<form method="post" action="">
<fieldset>
<div>
<label for="two">2</label>
<input type="checkbox" value="2" id="two" name="number[]">
</div>
<div>
<label for="four">4</label>
<input type="checkbox" value="4" id="four" name="number[]">
</div>
<div>
<label for="six">6</label>
<input type="checkbox" value="6" id="six" name="number[]">
</div>
<div>
<label for="eight">8</label>
<input type="checkbox" value="8" id="eight" name="number[]">
</div>
</fieldset>
</form> </body>
<script>
var map=$(':checkbox').map(function() {
return ($(this).attr("id")+'='+$(this).val());
}).get().join('&');
alert(map)
</script>

最新文章

  1. java是值传递还是引用传递
  2. Asp.net Mvc 使用EF6 code first 方式连接MySQL总结
  3. 纯css3实现旋转的太极图
  4. SQL年月日方面的查询信息
  5. 通过ajax访问aspx的CodeBehind中的方法
  6. centOS 6.x 版本安装 node.js 4.x 以上版本的方法
  7. php.ini 配置文件的深入解析
  8. Pearls DP
  9. cmakelists 语法学习
  10. Letter Combinations of a Phone Number 解答
  11. SQL Server内存
  12. 使用git提交到github,每次都要输入用户名和密码的解决方法
  13. Android NFC技术(三)——初次开发Android NFC你须知道NdefMessage和NdefRecord
  14. 修改vue element Transfer 穿梭框里内容区的宽度
  15. Siamese Neural Networks for One-shot Image Recognition
  16. 使用IntelliJ IDEA开发SpringMVC网站(二)框架配置
  17. 【Matplotlib】数据可视化实例分析
  18. asp.net 项目目录说明
  19. Failed to register: Error: fabric-ca request register failed with errors [[{&quot;code&quot;:0,&quot;message&quot;:&quot;No identity type provided. Please provide identity type&quot;}]]解决方案
  20. [转]IOS 崩溃日志分析

热门文章

  1. Javascript高级程序设计读书笔记(第三章)
  2. 查看kafka的group.id
  3. Lanucherr 默认显示第几屏
  4. VC中遍历目标进程中的模块
  5. ps 换图片的背景颜色
  6. MFC下的aero效果学习笔记
  7. phpMyAdmin中mysql的创建数据库时的编码的问题
  8. js复制对象 和 节点类型和NodeList
  9. The Lead Game Add problem to Todo list Problem code: TLG
  10. 为什么说 Git 比 SVN 更好