弹出层局部刷新 AJAX

前端之家收集整理的这篇文章主要介绍了弹出层局部刷新 AJAX前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。



<script>

$(function(){
$("#dlg_form").submit(function(){
var postStr = "name="+$("#kbrealname").val()+"&sex="+$("#sex").val()+"&phone="+$("#phone").val()+"&crowd="+$("#crowd").val()+"&card_type="+$("#card_type").val()+"&card_number="+$("#card_number").val()+"&year="+$("#year").val()+"&month="+$("#month").val()+"&day="+$("#day").val();
$.ajax({
type: "POST",
contentType: "application/x-www-form-urlencoded",
url: "ryajax.PHP",
data: postStr,
error: function(){
alert( '您所请求的页面有异常,请刷新重试。' );
},
success: function(msg){
if(msg=="" ){
return false;
}
else{
$( "#ryadd").html(msg);
$(".cusedit").css("display","none");
}
}
});
});
});

</script>


<form id="dlg_form" method="post" onSubmit="return false;"> <div class="editcuscircle"> <p><a class="closebtn" href="javascript:;"></a></p> <div> <label for="kbrealname">真实姓名:</label> <input type="text" placeholder="管理员真实姓名" id="kbrealname" name="name" value=""><b>请填写真实姓名,以免影响您入住</b> </div> <div class="cussex"> <label>性别:</label> <ul class="sex"> <li><span data-val="1" ></span>男</li> <li><span data-val="0"></span>女</li> <input type="hidden" value="" name="sex" id="sex" /> </ul> </div> <div class="longnum"> <label>手机号码:</label> <input type="text" placeholder="手机号" name="phone" id="phone" value="<?PHP echo $singdata['phone']; ?>" /> </div> <div> <label>类型:</label> <select name="crowd" id="crowd"> <?PHP foreach ($crowd as $k => $v){ echo '<option value="'.$v['id'].'">'.$v['name'].'</option>'; } ?> </select> </div> <div> <label>证件:</label> <select name="card_type" id="card_type"> <?PHP foreach ($card_type as $k => $v){ echo '<option value="'.$v['id'].'">'.$v['name'].'</option>'; } ?> </select> </div> <div class="longnum" > <label>证件号码:</label> <input type="text" placeholder="证件号码" name="card_number" id="card_number" value="<?PHP echo $singdata['card_number']; ?>" /> </div> <div> <label for="">出生年月:</label> <select class="sel_year" style="width:100px; overflow:hidden;" id="year" name="year" rel=""></select>年 <select class="sel_month" style="width:100px;overflow:hidden;" id="month" name="month" rel=""></select>月 <select class="sel_day" style="width:100px;overflow:hidden;" name="day" id="day" rel=""></select>日 </div> <input type="submit" class="save" name="sub" value="保存" /> </div> </form> </div> <script> $(function () { $.ms_DatePicker({ YearSelector: ".sel_year",MonthSelector: ".sel_month",DaySelector: ".sel_day" }); $.ms_DatePicker(); $(".deleteall").click(function(){ $("#dels").submit(); }); }); </script>

原文链接:https://www.f2er.com/ajax/163298.html

猜你在找的Ajax相关文章