Ajax asynchronous upload file data parameter----small Ha Co JS

Source: Internet
Author: User

  1. Download ajaxfileupload.js (download URL: http://fileuploadajax.codeplex.com/downloads/get/20976)
  2. Modify Ajaxfileupload.js Internal Program
    1 one, about 32 lines2Createuploadform:function(ID, fileelementid,data)3 Two, about 47 lines4JQuery (Form). AppendTo (' body '); Add the code before5     if(data) {6           for(varIinchdata) {7$ (' <input type= ' hidden "name=" ' + i + ' "value=" ' + data[i] + ' "/> '). AppendTo (form);8          }9      }Ten three, about 61 lines to modify One     varform = Jquery.createuploadform (ID, s.fileelementid,s.data);
    View Code

  3. The third step is to start calling the
    1 functionFileUpload () {2         varJiangshi_name = $ ("#jiangshi_name"). Val ();3         varJiangshi_rongyu = $ ("#jiangshi_rongyu"). Val ();4         varJiangshi_xueli = $ ("#jiangshi_xueli"). Val ();5 $.ajaxfileupload ({6Type: "POST",7URL: "/ben/main_guanli.php",8 data: {9ETC: "TEACHERUPD",Ten Jiangshi_name:jiangshi_name, One Jiangshi_rongyu:jiangshi_rongyu, A Jiangshi_xueli:jiangshi_xueli -             }, -             //to be passed to the background parameters, no can not write theSecureuri:false,//whether to enable secure commit, default to False -Fileelementid: ' Doc ',//ID property of the File selection box -DataType: ' JSON ',//format returned by the server -Asyncfalse, +Successfunction(data) { - alert (data); +             }, AErrorfunction(data, status, E) { atAlert ("Data Error") -             }, -         }); -}
    View Code

Ajax asynchronous upload file data parameter----small Ha Co JS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.