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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:05:46+00:00 2026-05-18T08:05:46+00:00

Hello I have this callback function when an image is uploaded to the server

  • 0

Hello I have this callback function when an image is uploaded to the server and I then want to show this image as a thumbnail generated by a PHP script

'onComplete'  : function(event, ID, fileObj, name,response, data) {
          var newfile = '/admin/includes/image.php?filename='+name+'&maxw=150';
          $('#uploaded_images').append('<li class="'+ID+'"><img src="/site_images/ajax-loader.gif"" alt="" /></li>').fadeIn('fast');
          $.get(newfile, function(){
                $('.'+ID).fadeOut().empty();
                $("."+ID).append('<img src="'+newfile+'" alt="" />').fadeIn();


});

the “.get” jquery function is supposed to show the img tag only after the image is loaded (and it does) the problem is that when I print the img tag the image is loaded again. This practically only fadesIn the “container” of the image. The image will continue to appear only when loaded and without any effect.
Is there a way I can arrange the script to use the image cached with “get” or actually print everything only when the image is loaded directly?

Thank you

  • 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-18T08:05:46+00:00Added an answer on May 18, 2026 at 8:05 am

    Instead of $.get(), use the .load() event of the image, like this:

    $("<img />").load(function() {
      var img = this;
      $('.'+ID).fadeOut(function() { $(this).html(img); }).fadeIn();
    }).attr("src", newfile);
    

    What this does is when the image element we’re creating finishes loading, fade out the .ID element, when the fade finishes, set the content to the <img> element (.html(elem) is a shortcut for .empty().append()), then fade it back in.

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

Sidebar

Related Questions

Hello stackoverflow contributors! I have this script that gets the starting position of my
I have done this: $ z() { echo 'hello world'; } How do I
I have the following line: 14:48 say;0ed673079715c343281355c2a1fde843;2;laka;hello ;) I parse this by using a
This is the HTML: <div id=testBlue> <span>hello</span> <span id=testGreen class=testGreen>hello2</span> </div> If I have
Hello we have an SQL server application running over a low bandwith connection. We
I have a file called hellowf.cs class MyFirstApp { static void Main() { System.Windows.Forms.MessageBox.Show(Hello,
I have some input checkboxes that are being dynamically generated in a $.post callback
Hello I have this table structure: **ProductsTable** ProductID ProductName **CategoriesTable** CategoryID CategoryName **ProductCategories** ProductID
For example i have this string: $test_str = num Test \n num Hello \n
I have a callback function within an ASP.NET Web Forms application which I am

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.