欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery中的AjaxSubmit使用講解

 更新時(shí)間:2016年09月25日 11:00:40   作者:郝世海  
最近使用ajaxform有點(diǎn)頻繁,今天小編抽時(shí)間給大家記錄下有關(guān)jquery中的ajaxSubmit使用講解的知識(shí),非常不錯(cuò),感興趣的朋友參考下吧

最近在使用ajaxForm,隨便把使用方法記下下來(lái),以便以后回顧。

1 ,引入依賴腳本

<script type="text/javascript" src="/js/jquery/jquery.form.js"></script> //ajaxForm 依賴腳本
<script type="text/javascript" src="/js/jquery/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="/js/jquery/jquery.easyui.min.js"></script>

2 使用方法

<form name="testForm" id="testForm" >
<input type="button" value="submit"/>
</form>
<script type="text/javascript">
var ajax_option={
url:"login",//默認(rèn)是form action
success:function(data){
}
$('#testForm').ajaxSubmit(ajax_option);
}
</script>
//注意$("#testForm") 引號(hào)中名稱必須要和form元素id值要保持一致

3 ajaxSubmit 和ajaxForm區(qū)別

ajaxForm不能提交表單。在document的ready函數(shù)中,使用ajaxForm來(lái)為AJAX提交表單進(jìn)行準(zhǔn)備。提交動(dòng)作必須由submit開始

ajaxSubmit 馬上由AJAX來(lái)提交表單。你可以在任何情況下進(jìn)行該項(xiàng)提交。

4 option的參數(shù)

var options = { 
target: '#output1', // target element(s) to be updated with server response 
beforeSubmit: showRequest, // pre-submit callback 
success: showResponse // post-submit callback 
// other available options: 
//url: url // override for form's 'action' attribute 
//type: type // 'get' or 'post', override for form's 'method' attribute 
//dataType: null // 'xml', 'script', or 'json' (expected server response type) 
//clearForm: true // clear all form fields after successful submit 
//resetForm: true // reset the form after successful submit 
// $.ajax options can be used here too, for example: 
//timeout: 3000 
};

以上所述是小編給大家介紹的jQuery中的AjaxSubmit使用講解,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評(píng)論