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 8521149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:44:16+00:00 2026-06-11T06:44:16+00:00

I have an ajax upload script that returns an image that should swap out

  • 0

I have an ajax upload script that returns an image that should swap out an exiting loaded image in the dom.

For example

<img src="http://site.com/user1-profile-pic.jpg" id="profile" />

and uploading a new image returns json

{"url": "http://site.com/user1-profile-pic.jpg" }

I then run jQuery

$("#profile").attr('src', myjson.url);

but the image url is always the same, so I want to bust the cache for that image to load it again. Could it be as simple as appending ?timestamp onto the end of the image URL?

  • 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-06-11T06:44:17+00:00Added an answer on June 11, 2026 at 6:44 am

    it’s the same because it’s cached as you are using the same name, the trick is to use a different name.

    As you can’t use a different name, we append something to it:

    var dt = new Date(); 
    $("#profile").attr( 'src', myjson.url + '?dt=' + dt.getTime() );
    

    in just one call (as Sushil says):

    $("#profile").attr( 'src', myjson.url + '?dt=' + (+new Date()) );
    

    this will output as:

    enter image description here

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

Sidebar

Related Questions

I have a ajax image upload script which i found here http://www.fengcool.com/2009/06/ajax-form-upload-local-image-file-without-refresh/ The problem
I have read that ajax fileupload is not possible. But I want to upload
I have a a script that on click do a ajax call connect to
I have PHP page where users can upload photos (using Ajax & PHP script).
I have PHP page where users can upload photos (using Ajax & PHP script).
I am trying to code my own simple AJAX image upload script via jQuery.
I have a nice php and ajax script that uploads a photo and displays
I have a piece of javascript that uses Ajax and PHP to upload an
I have a some code to ajax upload . its send request to my
If I have form where user can upload files via Ajax (and upload is

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.