Jump to content

Help with Status Bar, using the Basic Start working Example


phorman

Recommended Posts

I have program that examines a specific directory, and under that directory is another directory of authors/Artists.  Then inside the author/artist directory is all the songs, or lectures given by the individual or group.  My program enters all the information into a Mysql Database (indexed) and allows for quick retrieval of requested content.

 

My problem is that the inserting process can take some time, and therefore I want a way to be able to display the current status of the process.

 

Here is what I have that I thought would work:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
#status {
height: 40px;
width: 740px;
background-image: url(template/images/bg_status.png);
}
#status #update {
background-image: url(template/images/status.png);
font-family: Arial, Helvetica, sans-serif;
font-size: 24px;
font-style: normal;
font-weight: bold;
color: #FFFFFF;
height: 35px;
padding-top: 5px;
text-align: center;
overflow: hidden;
}
-->
</style>
<script type="text/javascript" language="javascript" src="scripts/ajaxrequest.js"></script> 
<script type="text/javascript">
<!--
function updateProgress() {
   //MyAjaxRequest("none","batchmedia.php?action=process");
   upd = document.getElementById("update");
   do {
       MyAjaxRequest('status','batchmedia.php?action=show_status');
   } while (upd.value != "100%");
}



//-->
</script>
</head>

<body> 
<div id="status" name="status"></div>

   <form>
     <input type="button" name="start" value="Start" onclick="updateProgress()" />
     <div id="update" style="width:1%; "> 0% </div>
   </form>
   
</body>
</html>

 

This is the output generated by the batchmedia.php?action=show_status call:

 

  <div id="update" style="width:100%; ">
     100%
  </div>

 

The percentages are passed using php code.

 

This works, except I keep getting "Access Denied" or timeouts when this code runs.

The errors usally take a few minutes to pop up, and then when I answer them, the solution works as expected.

 

The error seems to come from :  "An exception of type "Access denied was not handled"....... coming from:

 //located in ajaxrequest.js
MyHttpRequest.open("get",url_encode(file +query_string),true); 

 

It should also be noted that this error is coming from Windows where no access is set on the file in the first place.

After it works in my test environment, I will move it to my linux server environment and test again.

 

Any help in this matter would be greatly appreciated.

 

Additional Thoughts:   May be its re-calling the script too soon, and some sort of pause should take place.  I came to this after removing the loop and just running through it once.  It worked without a problem.  When I introduce the loop, is when it stops working correctly.

  • 2 weeks later...

I had another thought, and that was that maybe this is a limitation of ajax, and it would be better to use comet instead.

 

I have tried all kinds of combinations and no success yet.  I will attempt to implement comet, and see if that helps matters.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.