源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

jQuery ajax中使用serialize()方法提交表单数据示例

  • 时间:2022-12-21 09:32 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:jQuery ajax中使用serialize()方法提交表单数据示例
jQuery ajax中数据以键值对(Key/Value)的形式发送到服务器,使用ajax提交表单数据时可以使用jQuery ajax的serialize() 方法表单序列化为键值对(key1=value1&key2=value2…)后提交。serialize() 方法使用标准的 URL-encoded 编码表示文本字符串。下面是使用serialize()序列化表单的实例:
[u]复制代码[/u] 代码如下:
$.ajax({    type: "POST",    url: ajaxCallUrl,    data: "Key=Value&Key2=Value2",    success: function(msg){alert(msg);}  });
ajax serialize():
[u]复制代码[/u] 代码如下:
$.ajax({          type: "POST",          url:ajaxCallUrl,          data:$('#formID').serialize(),// 要提交的表单          success: function(msg) {alert(msg);}      });
实例: [img]http://files.jb51.net/file_images/article/201310/2013101417324712.gif?201391417339[/img]
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部