Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4029524
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:21:22+00:00 2026-05-20T11:21:22+00:00

I am using a Comet, Realtime engine called APE, and I am using jQuery

  • 0

I am using a Comet, Realtime engine called APE, and I am using jQuery to refresh a PHP image. Initially I load the image like this:

<div id="container">
<img src="image.php" style='background: url(../assets/load.gif) no-repeat center center;margin-left:42px;' alt=' Loading ...' width="500px" height="300px" />
</div>

And then when I receive an event I do this:

$("#container").empty();
$("#container").html('<img src="image.php?device='+device+'" style="background: url(../assets/load.gif) no-repeat center center;margin-left:42px;" width="500px" height="300px" alt=" Loading ..."/>');

device is a var that I receive from the event, so for example I get device1, everything works ok (the image is actually a Chart) and the title changes to “device1” and it plots the last 5 minutes

However, my problem is every single time I receive an event, after this initial one, the date remains at the same five minute period. My device is the same each time, but inside my script I calculate the time epoch 5 minutes ago to the current time, but this script doesn’t seem to update the image. Is it being cached or something?

I have tried using this at the top of the page:

<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
?>

I can wait about 10 minutes, send an event, but the time period is still from the initial load, I thought that the “empty()” would clear the container out, reload the image and therefore rerun the script. Any advice would help!

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T11:21:23+00:00Added an answer on May 20, 2026 at 11:21 am

    A common approach is to add a trivial var to the query string that holds a unix timestamp; The browser sees each call as a call to a unique image. e.g.

    'image.php?device=' + device + '&t=' + Math.round((new Date()).getTime() / 1000);
    

    So that it doesn’t think it has a cached image. ( though it will continue whatever cache policy lead to this issue )

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it worth using Comet for events that are not needed in realtime, but
I'm trying to implement a comet style, long polling connection using an XMLHttpResponse object.
When using JDBC, I often come across constructs like ResultSet rs = ps.executeQuery(); while
I was thinking of implementing real time chat using a PHP backend, but I
I've developed some web-based applications till now using PHP, Python and Java. But some
I'm using jsonp to do cross-domain comet requests, and the loading status is really
I'm currently building a real-time betting engine using redis / thin / sinatra. A
Using IE8, jQuery 1.6.1.min.js. The JSON that comes from the REST service seems to
http://www.bidzinga.com/ http://www.bidbass.com/ Are they using COMET technology? What do you recommend to use, and
I'm using the windowsxp. The version of 'cat' that I'm using comes bundled with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.