教程集 www.jiaochengji.com
教程集 >  jQuery  >  jquery 教程  >  正文 jquery的表单内容序列化方法serialize

jquery的表单内容序列化方法serialize

发布时间:2016-09-02   编辑:jiaochengji.com
教程集为您提供jquery的表单内容序列化方法serialize等资源,欢迎您收藏本站,我们将为您提供最新的jquery的表单内容序列化方法serialize资源

jquery的表单内容序列化方法serialize

一、前端

<form class=”search_from”>



</form>

var container   = $(‘#xx_div’);

var search_form = $(container.find(‘form.search_form’));

var param       = search_form.serialize();

$.post(url,param,function(r){},’json’);

批注:

console.log(search_form);

console.log(search_form.serialize());

[form.search_form]index….ortscan (line 164)

ip=&port=&service=&o_ip_type=&status=&hostname=&department_id=&domain=&deal=-1&start_time=&end_time=&index=1&size=16

serialize()是jquery的一个方法,序列表表格内容为字符串

还有Array<Object>serializeArray() 返回 JSON 数据结构数据。

二、后端

$str = Yii::app()->request->getParam(‘param’);

parse_str($str, $param);

批注:parse_str() 函数把查询字符串解析到变量中。

parse_str(“id=23&name=John%20Adams”,$myArray);

print_r($myArray);

输出:

Array

(

  [id] => 23

  [name] => John Adams

)

您可能感兴趣的文章:
jQuery ajax serialize()方法的使用以及常见问题解决
jquery的表单内容序列化方法serialize
jQuery-serialize()输出序列化form表单值的方法
学习php serialize()与unserialize()的用法
jQuery中验证表单提交方式及序列化表单内容的实现
PHP中__sleep()方法详解
php serialize与unserialize语法
php对象的序列化与反序列化 PHP对象存储与传输
JavaScript表单序列化的方法详解
PHP中 __wakeup()方法详解

[关闭]
~ ~