没有更新页面重载的图片 [英] Updating a picture without page reload

查看:124
本文介绍了没有更新页面重载的图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么会去更新,获取更新了服务器出用户不必打的刷新按钮每两秒钟的图像,我的第一个猜测是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.

这篇关于没有更新页面重载的图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆