I am trying to use jQuery UI progress bar in my web app. But that is not getting displayed. I am using a DWR call to get the upload status. Before using Jquery UI progressbar, i just displayed the status returned from server as just as it is, to make sure the data coming from server. It was working fine.
The Code
<body>
<script type="text/javascript">
$(document).ready(function(){
var progressbar = $("#jqProgressBar");
progressbar.css({
开发者_StackOverflow中文版 "width" : "200px",
"height" : "10px"
});
$("#jqProgressBar").progressbar({'value':0});
});
function statusUpdate() {
FileUploadProgressListener.getFileUploadStatus(function(status){
if(status >= 95)
{
status = 100;
$("#jqProgressBar").progressbar({'value':status});
return;
}
else
{
$("#jqProgressBar").progressbar({'value':status});
window.setTimeout(statusUpdate, 200);
}
});
return true;
}
</script>
<h4>File Upload</h4>
<iframe id="uploadFrameID"
name="uploadFrame"
height="0" width="0"
frameborder="0"
scrolling="yes"></iframe>
<form action="ProfileImageUpload"
enctype="multipart/form-data" method="post"
onsubmit="setTimeout('statusUpdate()', 1000)" target="uploadFrame">
<input type="file" name="fileupload_upload" value="Upload File">
<input type="submit" value="Upload">
</form>
<div id="jqProgressBar"></div>
</body>
Any suggestions!!!
try using this line in the code that changes the value:
$("#jqProgressBar").progressbar(status);
精彩评论