jquery ajax fileupload.js 下载

    <script> 
    $.ajaxFileUpload( 
                    { 
                 url:'${ctx}/toImage.do',            //需要链接到服务器地址 
                 secureuri:false, 
                 fileElementId:'picUrl',                        //文件选择框的id属性 
                 dataType: 'json',                                     //服务器返回的格式,可以是json 
                 success: function (data, status)            //相当于java中try语句块的用法 
                 {     
                    $("#f1").append("<img src=\""+data+"\" style=\"width:150px;height:80px;\" />"); 
                 }, 
                 error: function (data, status, e)            //相当于java中catch语句块的用法 
                 { 
                    $.each(data,function(i,n){ 
                        $("#f1").append("<span>图片加载失败!</span>");     
                    }); 
                 } 
             } 
                    
                ); 
    </script> 

你可能感兴趣的:(jQuery ajax)