ajaxForm和ajaxSubmit 粘贴就可用的代码怎么写

今天就跟大家聊聊有关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>

看完上述内容,你们对ajaxForm和ajaxSubmit 粘贴就可用的代码怎么写有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注行业资讯频道,感谢大家的支持。