ajaxForm和ajaxSubmit 粘貼就可用示例代碼
更新時間:2014年02月12日 15:12:08 作者:
這篇文章主要介紹了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>
相關(guān)文章
ajax異步處理POST表單中的數(shù)據(jù)示例代碼
這篇文章主要介紹了如何利用ajax異步處理POST表單中的數(shù)據(jù),下面有個不錯的示例,大家可以參考下2014-06-06
Ajax讀取數(shù)據(jù)之分頁顯示篇實現(xiàn)代碼
前幾篇的ajax教程里講了,讀取,添加,修改,刪除的功能.有幾天沒有更新了,雖然網(wǎng)上也有很多ajax分頁的教程和相關(guān)實例.2010-10-10
添加后臺list給前臺select標簽賦值簡單實現(xiàn)
本文為大家介紹下通過添加后臺list怎么實現(xiàn)給前臺select標簽賦值,具體代碼如下,感興趣的朋友可以參考下哈2013-07-07
AngularJS tab欄實現(xiàn)和mvc小案例實例詳解
這篇文章主要介紹了angularJS tab欄實現(xiàn)和mvc小案例,本文通過實例代碼給大家介紹的非常詳細,需要的朋友可以參考下2017-05-05

