Ajax - caching?

Discussion in 'JavaScript' started by aras, Oct 18, 2006.

  1. #1
    Hello

    I use Ajax to reload a captcha (image-verification) area. A php file creates the image. I call getting the php file onClick from a Reload button. However, it sends the command to php file, but returns a cached value i guess, because it loads the same code again. If i refresh whole page (which i am using Java, not to :) ) it reloads the code too.

    How can i prevent this?

    I added a header sent in my php file for no-cache, did not work.
    I try to call the php file with different random variables like
    image.php?1301231
    image.php?123111

    Did not work too.
     
    aras, Oct 18, 2006 IP
  2. aras

    aras Active Member

    Messages:
    533
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    60
    #2
    I have made a simple echo of current time in my php file, ajax gathers it good, reloads with new time. But image is echoed previously as cached.
     
    aras, Oct 18, 2006 IP
  3. intoex

    intoex Peon

    Messages:
    414
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #3
    maybe try to send noi cache headers in image generation script?
     
    intoex, Oct 19, 2006 IP