日期:2014-05-17  浏览次数:20551 次

求教,文件上传进度条问题
我使用的apache commons,但是上传后,前面一直阻塞,进度条不动,一直到最后上传完,进度条跳到100%。请各位大侠帮忙看看,谢谢
jsp部分:
<script>
        var timeid;
        function callback(){
                //alert(123);
                $.ajax({
                        type:"post",  
                        url:"progress",//响应文件上传进度的servlet
                        success:function(msg){
                                //alert(msg);
                                value = msg;
                                if(value<100){
                                        document.getElementById("xxx").innerHTML="已上传:"+msg;//显示读取百分比   
                                }
                                else if(value==100){
                                        window.clearInterval(timeid);
                                        document.getElementById("xxx").innerHTML="已上传:"+msg;//显示读取百分比   
                                }
                        }
                });
        }
        function submitForm(){
                timeid = window.setInterval("callback()", 10);
                $('#ff').form('submit');
        }
</script>