Re: [問題] JQuery form serialization

作者: icydream (巧虎)   2014-03-13 05:57:31
※ 引述《shomingchang ( )》之銘言:
: 想請問為何 var formData = $('#testform').serialize(); 序列化出來的資料是空的?
: 感謝大家
: <!DOCTYPE html>
: <html xmlns="http://www.w3.org/1999/xhtml">
: <head>
: <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
: <title></title>
: <script src="Scripts/jquery-2.1.0.js"></script>
: <script type="text/javascript">
: $(document).ready(function () {
: $('#btnSerialize').on('click', Serialize);
: $('#btnDecode').on('click', Decode);
: });
...[恕刪]
擷取片段的jQuery(v2.0.3)的程式碼:
// Serialize the form elements
jQuery.each( a, function() {
add( this.name, this.value );
});
由此可知,jQuery是使用name來取得elements的值
作者: shomingchang ( )   2014-03-13 06:44:00
了解 感謝

Links booklink

Contact Us: admin [ a t ] ucptt.com