jquery submit serialized form
http://www.wangyexx.com/jquery/jc/1009.html
1. $("#form1").serialize(); // e.g. a=bob%3Dblog&b=1&c=1 autoencoding
2. $("#form1").serializeArray(); return json, php: json_decode
3. $.param({a:1,b:2,c:3}); // e.g. a=1&b=2&c=3
php dealing with uploaded file and normal form data
ps.
things about File beautifier
1. ie got access denied when using ele.click() to call out the dialogue box
2. use opacity:0; filter:alpha(opacity=0); instead to cover a div
3. make file following the cursor when mousemove on div
http://www.wangyexx.com/jquery/jc/1009.html
1. $("#form1").serialize(); // e.g. a=bob%3Dblog&b=1&c=1 autoencoding
2. $("#form1").serializeArray(); return json, php: json_decode
3. $.param({a:1,b:2,c:3}); // e.g. a=1&b=2&c=3
php dealing with uploaded file and normal form data
<?php
// 'fileData' is the fieldname in html for file tag
if(isset($_FILES['fileData']['name'])){
$target_path = "";
$target_path = $target_path . basename( $_FILES['fileData']['name']);
if(move_uploaded_file($_FILES['fileData']['tmp_name'], $target_path)) {
echo "{'status':'success'}";
} else{
echo "{'status':'error'}";
}
file_put_contents('normalFormData.txt', $_POST['-other normal fieldname-'].' \n '.$_POST['-other normal fieldname-']);
}
ps.
things about File beautifier
1. ie got access denied when using ele.click() to call out the dialogue box
2. use opacity:0; filter:alpha(opacity=0); instead to cover a div
3. make file following the cursor when mousemove on div

本文深入探讨了jQuery中序列化表单的方法,包括serialize()、serializeArray()和$.param(),并展示了如何处理上传文件和常规表单数据。同时,提供了解决使用元素点击调出对话框时遇到的访问权限问题的方案,以及通过覆盖div来解决透明度问题的技巧。
1万+

被折叠的 条评论
为什么被折叠?



