没有更新页面重载的图片页面、图片

2023-09-10 16:53:24 作者:摸清我的脾气在装逼i

我怎么会去更新,获取更新了服务器出用户不必打的刷新按钮每两秒钟的图像,我的第一个猜测是AJAX,但我还没有真正工作过它。可能有人点我在正确的方向?

How would I go about updating an image that gets updated on a server every couple of seconds with out the user having to hit the refresh button, my first guess was ajax but I haven't really worked with it before. Could someone point me in the right direction?

编辑:忘了提,该图像是由Perl脚本生成为.gif - 试图通过URL来抓住它返回一个脚本

Forgot to mention that the image is a .gif generated by a perl script - trying to grab it by url return a script

推荐答案

好像有什么不对您的Perl脚本。试图由URL来访问图象应该无论如何返回图像。它应该返回二进制数据,而不是一个脚本。您还应设置应对图像/ GIF的Content-type头。验证是否确实返回二进制数据试图解决您的JavaScript code之前。

It seems there is something wrong with your Perl script. Trying to access the image by the URL should return an image anyway. It should return binary data and not a script. You should also set the Content-type header of the response to image/gif. Verify if it indeed returns binary data before trying to fix your JavaScript code.