html5中文学习网

您的位置: 首页 > 网站及特效实例 > jquery特效 » 正文

ajaxForm和ajaxSubmit 粘贴就可用示例代码_编程语言综合

[ ] 已经帮助:人解决问题

 这篇文章主要介绍了ajaxForm和ajaxSubmit 粘贴就可用示例代码,需要的朋友可以参考下hQjHTML5中文学习网 - HTML5先行者学习网

代码如下:
<!-- 
To change this template, choose Tools | Templates 
and open the template in the editor. 
--> 
<!DOCTYPE html> 
<html> 
<head> 
<title></title> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
<script src="jquery-1.7.2.min.js"></script> 
<script src="jquery.form.js"></script> 
<script> 
//ajaxForm 
var optionss = { 
dataType:"text", 
type:'post', 
url: "chuli.php", 
beforeSubmit:showRequest, 
success:showResponse, 
clearForm:true 
}; 
$('#form1').ajaxForm(optionss); 
function showRequest() { } 
function showResponse(data){ 
alert(data); 
</script> 
</head> 
<body> 
<form action="chuli.php" method="post" id="form1"> 
<input type="text" name="name" /> 
<input type="text" name="sex" /> 
<input type="submit" value="提交"/> 
</form> 
<hr /> 
<form action="chuli.php" method="post" id="form2"> 
<input type="text" name="name" /> 
<input type="text" name="sex" /> 
<input type="button" id="tijiao" value="提交"/> 
</form> 
</body> 
<script> 
//ajaxSubmit 
$("#tijiao").click(function(){ 
$("#form2").ajaxSubmit({ 
success:function(data){ 
alert(data); 
}) 
}); 
</script> 
</html> 
 
(责任编辑:)
推荐书籍
推荐资讯
关于HTML5先行者 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助