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

  • Home
  • SEARCH
  • 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 925269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:29:37+00:00 2026-05-15T19:29:37+00:00

I have an image on the page. I’m using the AJAX form plugin to

  • 0

I have an image on the page. I’m using the AJAX form plugin to upload a single image, and after the photo has uploaded I’d like to refresh the image that is already on the page.

$("#profilePicForm").ajaxForm(function() { 
    alert("Photo updated");
    $("#newPhotoForm").slideToggle();
    $("#profilePic img").load(function() {
        $(this).hide();
        $(this).fadeIn('slow');
    }).attr('src', '/Content/UsrImg/Profiles/PhotoName.jpg');
}); 

The newly uploaded file has the same name as the old one, all that is needed is a way to refresh the image. Since it is the same name, cache is getting in the way – the method described in this article didn’t work.

Any ideas?

  • 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-15T19:29:37+00:00Added an answer on May 15, 2026 at 7:29 pm

    The article you linked isn’t working here, but you can break the cache with a query string on the image, like this:

    $("#profilePicForm").ajaxForm(function() { 
      alert("Photo updated");
      $("#newPhotoForm").slideToggle();
      $("#profilePic img").load(function() {
        $(this).hide();
        $(this).fadeIn('slow');
      }).attr('src', '/Content/UsrImg/Profiles/PhotoName.jpg?' + new Date().getTime());
    }); 
    

    This forces the browser to check for the image again, since the timestamp is being adding to the query string, it’s different every time. This means the browser just can’t trust the cache anymore, since that’s a slightly different server request…so it’ll result in a re-fetch like you want.

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

Sidebar

Related Questions

I have an image upload page (single page). When submitted it check filesize and
i have a page for a small mobile site that has an image that
I have been searching a plugin/module for Joomla where: Loads random image on page
I have an image on my master page like this: <img src=../Images/logo.jpg /> The
In my asp.net project, I have a view-image page and an upload-image page. I
In sql server database, I have column name Image which has urls like http://www.xyz.com/1009/image1.jpg
I have a page with a few fields and a runtime-generated image on it.
I have an aspx page,where the user will enter a valid image url(ex :
I have an ASPX page where I am uploading an image to server for
I have a web page that includes a bunch of images. Sometimes the image

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.