---
title: "jquery ajax  $.param()方法序列化字符串"
author: "小丑鱼0703"
date: "2015-02-05T16:45:34Z"
tags: []
categories: ["Web前端"]
slug: "jquery-ajax-param"
draft: false
lastmod: "2015-02-09T11:41:27Z"
id: 2181847
url: "https://wangjingyi.iteye.com/blog/2181847"
---

jQuery.param( obj )将表单元素的值转换为序列化字符串，用于URL查询字符串或Ajax请求。
param() 方法创建数组或对象的序列化表示。


```html

<script type="text/javascript">
$(document).ready(function(){
  var personObj={"name":"wjy","age":27,"eyecolor":"black"};
  $("button").click(function(){
    $("div").text($.param(personObj));
  });
});
</script>
</head>
<body>
<button>序列化对象</button>
<div></div>
</body>
```

结果：name=wjy&age=27&eyecolor=black

<http://www.w3school.com.cn/jquery/ajax_param.asp>