Explanation on the use of ajaxSubmit in Jquery
Jul 03, 2017 am 10:46 AMI have been using ajaxForm recently, so I just jot down the usage method for future review.
1, introduce dependency script
<script type="text/javascript" src="/js/jquery/jquery.form.js"></script> //ajaxForm depends on script
<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 How to use
##<form name=" testForm" id="testForm" >
<input type="button" value="submit"/>
</form>
##<script type="text/javascript">var ajax_option={
##url:"login",//The default is form
action}
$('#testForm').ajaxSubmit(ajax_option);
}
</script>
##//Note that $("#testForm") the name in quotation marks must be consistent with the form element id value
3 The difference between ajaxSubmit and ajaxForm
ajaxForm cannot submit the form. In the ready function
ofdocument, use ajaxForm to prepare for AJAX submission of the form. The submission action must start with submit
##ajaxSubmit
##4
option的参数
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
};
The above is the detailed content of Explanation on the use of ajaxSubmit in Jquery. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Detailed explanation of jQuery reference methods: Quick start guide

How to use PUT request method in jQuery?

How to remove the height attribute of an element with jQuery?

jQuery Tips: Quickly modify the text of all a tags on the page

Use jQuery to modify the text content of all a tags

In-depth analysis: jQuery's advantages and disadvantages

Understand the role and application scenarios of eq in jQuery

How to tell if a jQuery element has a specific attribute?
