gooUploader 如何从服务器取数据
  TEZNKK3IfmPf 2023年11月15日 28 0
在GooUploader.js里有一段
this.$swfUpload.uploadSuccess=function(file,msg){
         var id=file.id;
         inthis.$fileList[id].span.html("100%");
         var li=inthis.$content.children("#"+id);
         li.children(".op_no").css("display","none");
         li.children(".op_ok").css("display","block");
      
     }; 
其中msg就是从服务器返回的数据。只要加上自己的处理函数就可以处理,如:
 this.$swfUpload.uploadSuccess=function(file,msg){
 var id=file.id;
 inthis.$fileList[id].span.html("100%");
 var li=inthis.$content.children("#"+id);
 li.children(".op_no").css("display","none");
 li.children(".op_ok").css("display","block");
 var callback=property.upload_complete;
 callback(msg);

 }; 
其中property.upload_complete为
var property={
        width:400,
        height:90,
        multiple:false,
        file_types_description: "资源文件",
           btn_add_text:"添加",
        btn_up_text:"上传",
        btn_cancel_text:"放弃",
        btn_clean_text:"清空",
        op_del_text:"单项删除",
        op_up_text:"单项上传",
        op_fail_text:"上传失败",
        op_ok_text:"上传成功",
        op_no_text:"取消上传",
        upload_url:"/admins/uploadResource.action",
        flash_url:"/codebase/swfupload.swf",
        upload_complete:upComplete
       };的一个参数。
 
我的upComplete函数如下:
 function upComplete(msg){
     var strArray=msg.split(':');
      $("#upload_resource").remove();
      var upload_resource=$(" = 文件:"+strArray[1]+"以上传! = = = = = =");
      $("#upload_resource_td").append(upload_resource);
      
     }
    服务器返回的数据写法如下:
 ServletActionContext.getResponse().getWriter().println(resource.getId()+":"+resource.getFileName());
 
ok完成!
【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月15日 0

暂无评论

TEZNKK3IfmPf