Home > Article > Web Front-end > Use JQuery to implement asynchronous form submission and file upload functions
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:
Jquery.form.js is a plug-in that can submit forms and upload files asynchronously.
Examples are as follows:
index.html
< 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.php
php /** * Created by JetBrains PhpStorm. * User: smeoi * To change this template use File | Settings | File Templates. */ echo ''; print_r($_POST); echo ''; echo ''; print_r($_FILES); echo '';
Rendering :
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!