$("#form1".submit)(function(){
$("#form1").ajaxSubmit();
return false;
})
$("#MailForm").ajaxSubmit(function(message) {
alert("表单提交已成功!");
});
var options={
url:url, //form提交数据的地址
type:type, //form提交的方式(method:post/get)
target:target, //服务器返回的响应数据显示在元素(Id)号确定
beforeSubmit:function(), //提交前执行的回调函数
success:function(), //提交成功后执行的回调函数
dataType:null, //服务器返回数据类型
clearForm:true, //提交成功后是否清空表单中的字段值
restForm:true, //提交成功后是否重置表单中的字段值,即恢复到页面加载时的状态
timeout:6000 //设置请求时间,超过该时间后,自动退出请求,单位(毫秒)。
}
<script src="jQuery.1.8.3.js" type="text/javascript"></script>
<script src="jQuery.Form.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$(":submit").click(function () {
var options = {
url: "indexAjax.aspx",
target: "#div2",
success: function () {
alert("ajax请求成功");
}
};
$("#form1").ajaxForm(options);
})
})
</script>
<div id="div1"> <form id="form1" method="get" action="#"> <p>我的名字:<input type="text" name="name" value="请输入内容" /></p> <p>我的偶像是:<input type="radio" name="Idol" value="刘德华" />刘德华 <input type="radio" name="Idol" value="张学友" />张学友</p> <p>我喜欢的音乐类型:<input type="checkbox" name="musictype" value="1.摇滚">摇滚 <input type="checkbox" name="musictype" value="2.轻松">轻柔 <input type="checkbox" name="musictype" value="3.爵士">爵士</p> <p><input type="submit" value="确认" /></p> </form> </div> <div id="div2"> </div>
protected void Page_Load(object sender, EventArgs e)
{
string strName = Request["name"];
string strIdol = Request["Idol"];
string strMusicType = Request["musictype"];
Response.Clear();
Response.Write("我的名字是:" + strName + "; 我的偶像是:" + strIdol + "; 我喜欢的音乐类型:" + strMusicType);
Response.End();
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有