学习jQuery在表单信息修改之中的常用方法;

时间:2023-03-09 22:19:35
学习jQuery在表单信息修改之中的常用方法;
             submitHandler: function (form) {
                 var parm = $("#myform").serialize();

                 var url = $("#myform").attr("action");
                 $.ajax({
                     url: url,
                     data: parm,
                     type: "POST",
                     success: function (data) {
                         if (data.result == '1') {
                             new Dialog('<div class="tj-success">修改成功!</div>', { time: 2000 }).show();
                         } else {
                             new Dialog('<div class="tj-fail">失败,请重试!</div>', { time: 2000 }).show();
                         }
                     }
                 });

             }
.serialize()输出序列化表单值的结果;radio、check、
                     <div class="form-group">
                                         <label class="col-sm-3 control-label no-padding-right" for="form-field-1"> 状态: </label>

                                         <div class="col-sm-9">
                                             <label>
                                                 <input name="display" type="radio" value="1" class="ace" <if condition="$display eq 1">checked</if>>
                                                 <span class="lbl"> 显示 </span>
                                                 <input name="display" type="radio" value="0" class="ace" <if condition="$display eq 0">checked</if>>
                                                 <span class="lbl"> 隐藏 </span>
                                             </label>
                                         </div>
                                     </div>

百度编辑器,在数据库之中的存储类型为 text

                     <div class="form-group">
                                         <label class="col-sm-3 control-label no-padding-right" for="form-field-1">内容:</label>

                                         <div class="col-sm-9" style="width:35%;">
                                             <script id="editor" name="content" type="text/plain" style="height: 400px">
                                                 <?php echo str_replace('\\','',$content);?>
                                             </script>

                                         </div>
                                     </div>

那个script是在百度编辑器demo.html里面直接拷贝的,只要js、css等全部引用到,你就可以$_POST打印出数据啦!!!