ajaxForm和ajaxSubmit 粘贴就可用示例代码
<!--
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>
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
-
-
-
7月15日笔试总结
测验项目:3C数码商城+简答题+选择题测验时间:3小时不足之处:简答题3道题留白,完全不懂,仍需复习,一道题简写...
[阅读全文]
-
-
-
-
-
原生AJAX
AJAXAJAX 是指一种创建交互式、快速动态网页应用的网页开发技术,无需重新加载整个网页的情况下,能够更新部...
[阅读全文]
-
-
网友评论