ajaxFileUpload实现带参数提交

阅读更多
修改了3个地方

 [b]createUploadForm: function(id, fileElementId, data)[/b]  

    {  

        //create form     

        var formId = 'jUploadForm' + id;  

        var fileId = 'jUploadFile' + id;  

        var form = $('
'); var oldElement = $('#' + fileElementId); var newElement = $(oldElement).clone(); $(oldElement).attr('id', fileId); $(oldElement).before(newElement); $(oldElement).appendTo(form); //增加文本参数的支持 [b]if (data) { for (var i in data) { $('').appendTo(form); } } [/b] //set attributes $(form).css('position', 'absolute'); $(form).css('top', '-1200px'); $(form).css('left', '-1200px'); $(form).appendTo('body'); return form; }, ajaxFileUpload: function(s) { // TODO introduce global settings, allowing the client to modify them for all requests, not only timeout s = jQuery.extend({}, jQuery.ajaxSettings, s); var id = new Date().getTime() [b]var form = jQuery.createUploadForm(id, s.fileElementId, s.data); [/b] var io = jQuery.createUploadIframe(id, s.secureuri);

你可能感兴趣的:(js,javascript,异步,上传文件)