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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:03:35+00:00 2026-05-25T17:03:35+00:00

I’m trying to preload an image while waiting for a change of text in

  • 0

I’m trying to preload an image while waiting for a change of text in my tag.

I have an ajax where if user clicks a text, they can be able to change the text, then when user submits it, it will be updated in mysql from the ajax.

My problem is that, when the user is finished changing the text, it takes awhile for the text to finally change. NOt sure if its cause I have a lot of “if(isset)” in my file where its going to be updated, or my algorithm… whatever it is, I’m trying to have a preloader image fix this.

            $.ajax({
            type: "POST",
            url: "ajax_table_edit.php",
            data: Data,
            cache: false,
            success: function(data)
            {
                $('textarea#item_'+id).load('<img src="img/ajax-loader.gif"/>');
                $('span#selector_'+id).html(selector);

            }
            });

The image is not showing up, and it is in the right path and everything.

To Summarize my problem:

User clicks text -> user changes text -> submits text -> text stays the same for a bit -> then new text pops up.

To summarize what I’m trying to do:

User clicks text -> user changes text -> submits text -> original text goes up and then the preloader image shows up -> preloader image goes away -> new text

Thanks for your time!

  • 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-25T17:03:35+00:00Added an answer on May 25, 2026 at 5:03 pm
    success: function(data)
    {
        $('textarea#item_'+id).load('<img src="img/ajax-loader.gif"/>');
        $('span#selector_'+id).html(selector);
    
    }
    

    problems I can see…

    1. you shouldn’t have load the image on a textarea
    2. you’r showing the image and the new text at the same time.

    My suggestions..

    when the user submit the text, show/append the image loader.

    maybe do it on the <form>‘s submit (or on the click of the button). then do your ajax. Once the ajax is done, hide the image then show the text.

    $('form').submit(function(){
    
       // use .after() or whatsoever, just show the image on this line.
       // while the form is about to execute the ajax codes below.
       var image = $('.preloader');
       if (image.length > 0) { // if preloader image exist... just show it..
           image.show();
       } else { // if it doesn't exist, create it.
           image = $('<img class="preloader" src="img/ajax-loader.gif"/>');
           $('textarea#item_'+id).after(image);
       }
    
       $.ajax({
           type: "POST",
           url: "ajax_table_edit.php",
           data: Data,
           cache: false,
           success: function(data)
           {
              image.hide(); // hide the image.
              $('textarea').text(data); // show the data...
    
              // by the way, I don't understand this next line
              //$('span#selector_'+id).html(selector);
    
           }
       });
       return false; //prevent form from jumping to another page
    
    });
    

    this is really a simple example, you can still do much more…

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a text area in my form which accepts all possible characters from
I have a reasonable size flat file database of text documents mostly saved in
I am trying to loop through a bunch of documents I have to put
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.