jquery的一个问题
这个是我的前台
<script>
var id=0;
function addressAction(){
$.post(
'./upload/progress.action',
function(data){
if(data.currentItem==0){
$("#m").text('0%');
}else if(data.state.rate!=100){
$("#m").text(data.state.readedBytes+'/'+data.state.totalBytes+':'+data.state.rate+'%');
}else if(data.state.rate==100){
$("#m").text(data.state.readedBytes+'/'+data.state.totalBytes+':'+'100% 上传完成!');
window.clearInterval(id);
$("#m").text('正在写入数据库,请稍等');
}
$("#img").html("");
var num=data.state.rate/10;
for(var i=1;i<=num;i++){
$("#img").append("<img src='./images/grid.gif' />");
}
for(var j=1;j<=10-num;j++){
$("#img").append("<img src='./images/gray.gif' />");
}
},
'json'
);
}
function read(){
alert('123456');
}
function uploadAction(){
$.post(
'./upload/upload.action',
function(data){
alert('324234');
},
'json'
);
}
function submitForm(){
if($("#f1").val()==""){
alert('上传文件为空!!!');
return ;
}
id=window.setInterval(addressAction,1000);
//uploadAction();
$("form:first").submit();/*提交第一个表单*/
}
</script>
</head>
<body>
<form action="upload/upload.action" method="post" enctype="multipart/form-data">
File:<input type="file" name="file" id="f1" />
<br/>
<span id="m"></span><br/>
<span id="img"></span>
<br/>
<input type="button" onclick="submitForm()" value="上传" />
</form>
我是传递到strust2里面进行处理的
<constant name="struts.multipart.maxSize" value="500000000000000" />
<package name="upload" namespace="/upload" extends="json-default">
<!-- 查询上传进度 -->
<action name="progress" class="action.FileProgressAction">
<result name="success" type="json"></result>
</action>
<!-- 上传文件 -->
<action name="upload" class="action.FileProgressUploadAction">
<result name="success&qu