jquery series tutorial 6-AJAX full solution
serialize() serialization, convert elements into xx=xx&xx=xx&xx= xx string form can not only be used in forms.
The code is as follows:
$(":checkbox,:radio").serialize(); //只会将选中的值序列化//serializeArray序列化dom元素,返回JSON格式数据 var fields = $(":checkbox,:radio").serializeArray(); $.each(fields,function(i,field){ field.key; //JSON的key field.value; //JSON的值});//$.param()方法,序列化数组或映射 var obj={a:1,b:2,c:3}; var k= $.param(obj); //转化为a=1&b=2&c=3
The above is the detailed content of Detailed explanation of examples of serialize() serialization function in jquery. For more information, please follow other related articles on the PHP Chinese website!