Im actually having a lot of problems with this. My code is as follows:
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title></title>
<script type="text/javascript">
window.addEvent('domready', function() {
startDownload(src, dest);
while(1) {
getDownloadProgress(dest);
sleep(2);
}
});
function startDownload()
{
var request = new Request(
{
url: reqUrl,
onSuccess: function(response)
{
alert('download done');
}
}
);
request.send();
}
function getDownloadProgress()
{
var request = new Request(
{
url: reqUrl,
onSuccess: function(response)
{
$('percent_complete').innerHTML=response;
}
}
);
request.send();
}
</script>
</head>
<body>
<div id="percent_complete"></div>%
</body>
</html>
The problem seems to be that mootools is having trouble running simultaneous ajax calls. It starts the download, but never updates the progress until the actual download is done. I thought ajax was suppose to be asynchronous?? Any ideas?
Bookmarks