$ .getfunction未在Chrome中运行,但在IE和FireFox中运行

我正在使用php POST将文件上传到服务器的网站,我正在尝试为上传添加进度条。 我按照这个指南:

http://www.ultramegatech.com/2010/10/create-an-upload-progress-bar-with-php-and-jquery/

它在ie和firefox中运行良好。 但进度条永远不会更新chrome。

调用此函数时超时为“500”。

function updateProgress(id) { var time = new Date().getTime(); // Make a GET request to the server // Pass our upload identifier as a parameter // Also pass current time to prevent caching $.get('progressbar.php', { uid: id, t: time }, function (data) { // Get the output as an integer var progress = parseInt(data, 10); if (progress < 100 || !started) { var div = document.getElementById('statusfield'); div.innerHTML = progress + '%'; // Determine if upload has started started = progress  99) { var div = document.getElementById('statusfield'); div.innerHTML = 'Komprimerar fil...'; } // Update the progress bar percentage // But only if we have started started && pbar.progressbar('value', progress); }); } 

此函数调用.php文件“progressbar.php”,该文件将上载进度作为百分比数传回。

progressbar.php:

  

我已经在chrome中测试了代码,并调用了函数“updateProgress”。 但它永远不会超越:

 $.get('progressbar.php', { uid: id, t: time }, function 

有没有人知道什么是错的?

谢谢!

在Chrome中转到开发工具(选项 – >工具 – >开发人员工具)并查看网络面板。 调用$ .get方法后,您将看到您的请求和结果 – 您可以看到它是否失败(例如,如果发生404),那么chrome可能不会设置地址,或者发送数据/返回数据还不行。