日期:2014-05-16  浏览次数:20610 次

关于ajaxFileUpload插件的几个问题!
本帖最后由 LZOMLZOM 于 2013-10-11 22:52:06 编辑
我刚刚学习使用ajaxFileUpload插件,有两个问题如下,求教!

一、网上找到的例子中ajaxFileUpload的参数为什么分为两种?
    1、第一种,类似于如下语句
      

         url:'fileUploadAction.action',//用于文件上传的服务器端请求地址
                secureuri:false,//一般设置为false
                fileElementId:'file',//文件上传空间的id属性  <input type="file" id="file" name="file" />
                dataType: 'json',//返回值类型 一般设置为json
                success: function (data, status)  //服务器成功响应处理函数
                {
                    alert(data.message);//从服务器返回的json中取出message中的数据,其中message为在struts2中action中定义的成员变量
                    
                    if(typeof(data.error) != 'undefined')
                    {
                        if(data.error != '')
                        {
                            alert(data.error);
                        }else
                        {
                            alert(data.message);
                        }
                    }
                },
                error: function (data, status, e)//服务器响应失败处理函数
                {
                    alert(e);
                }
            }
        )