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="https://www.jb51.net/jquery-1.7.2.min.js"></script>
<script src="https://www.jb51.net/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">
<input type="text" />
<input type="text" />
<input type="submit" value="提交"/>
</form>
<hr />
<form action="chuli.php" method="post">
<input type="text" />
<input type="text" />
<input type="button" value="提交"/>
</form>
</body>
<script>
//ajaxSubmit
$("#tijiao").click(function(){
$("#form2").ajaxSubmit({
success:function(data){
alert(data);
}
})
});
</script>
</html>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wfwggf.html