Home  >  Article  >  Web Front-end  >  Use JQuery to implement asynchronous form submission and file upload functions

Use JQuery to implement asynchronous form submission and file upload functions

巴扎黑
巴扎黑Original
2017-08-22 16:59:521811browse

The example in this article describes the JQuery asynchronous form submission and file upload functions. Share it with everyone for your reference, the details are as follows: UaHHTML5 Chinese Learning Network - HTML5 Pioneer Learning Network

Jquery.form.js is a plug-in that can submit forms and upload files asynchronously. UaHHTML5 Chinese Learning Network - HTML5 Pioneer Learning Network

Examples are as follows: UaHHTML5 Chinese Learning Network - HTML5 Pioneer Learning Network

index.htmlUaHHTML5 Chinese Learning Network-HTML5 Pioneer Learning Network



 
   
   
   
   
  < script type = "text/javascript"language = "javascript" > 
  $(function() { //异步提交表单    
    $("#ajaxSubmit").on("click",function(){      
      console.log($(this));      
        $("#formToUpdate").ajaxSubmit({     
             type:'post',          
             url:'p.php',          
             success:function(data){            
             console.log(data);          },          
             error:function(XmlHttpRequest,textStatus,errorThrown){          
               console.log(XmlHttpRequest);            
               console.log(textStatus);            
               console.log(errorThrown);     
                    }    
                   });   
                      }); 
                         });  
                         
  
 
  


p.phpUaHHTML5 Chinese Learning Network-HTML5 Pioneer Learning Network

';
print_r($_POST);
echo '
'; echo '
';
print_r($_FILES);
echo '
';

Rendering :UaHHTML5 Chinese Learning Network-HTML5 Pioneer Learning Network

UaHHTML5 Chinese Learning Network-HTML5 Pioneer Learning Network

The above is the detailed content of Use JQuery to implement asynchronous form submission and file upload functions. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn