54931716
http://yunzhu.iteye.com/blog/2177923
***********************************************
<!DOCTYPE HTML><HTML><Head> <title>Test</title> <MetaCharSet= "UTF8"> <Scriptsrc=".. /js/jquery-1.11.3.min.js "></Script></Head><Body> <formID= "form"> <inputname= "File"type= "File" /> <inputname= "a"value= "1" /> <inputvalue= "2" /> </form> <Button>Submit</Button></Body></HTML><Script> $(function() { //Monitor Upload Progress varxhronprogress= function(fun) {xhronprogress.onprogress=Fun ;//Binding Monitoring return function() { //get XMLHttpRequest objects by $.AJAXSETTINGS.XHR (); varXHR=$.ajaxsettings.xhr (); //determine if the listener function is a function if (typeofxhronprogress.onprogress!== 'function') returnXHR; //If there is a listener function and the XHR object supports binding, the listener function is bound if(xhronprogress.onprogress&&xhr.upload) {xhr.upload.onprogress=xhronprogress.onprogress; } returnXHR; } } $('Button'). On ('Click', function() { varFormData= NewFormData ($ ('#form')[0]);//automatic search of form information (input without the name attribute in the form is not searched), ie<=9 does not support FormdataFormdata.append ('b', 3);//You can also add additional form data$.ajax ({type:'Post', URL:'.. /.. /.. /material/jqueryfileupload?type=1', Data:formdata, ContentType:false,//This is required when there is a file to upload, otherwise the background does not recognize the starting location of the file stream (see: #1)ProcessData:false,//whether to serialize the Data property, default True (Note: False when type must be post, see: #2)xhr:xhronprogress (function(e) {//(see: #3) varpercent=e.loaded/e.total;//Calculate Percentage $('Body'). Append (' -'+percent); }), Success:function(data) {$ ('Body'). Append ('Complete'); } }) }) })</Script>
Submit Formdata Data using jquery